LINGO.BAS

Go back

Below you'll find the source for the QBasic file LINGO.BAS.

I've been in doubt if I'd republish this file again. Mainly for a few reasons;
1. The stuff I made as a kid is very childish (which kinda makes sense)
2. Times have changed; what was funny/innovative or sharable in 1997 doesn't meet standards in 2024.
3. Most of the code doesn't run natively anymore on modern operating systems.
4. It's in the Dutch language, where most of my shared content is in English.

Still, I've decided to share this file. Keep in mind the age of this content though.

Download LINGO.BAS for QBasic

DECLARE SUB OpenSamples ()
DECLARE SUB Toets ()
DECLARE FUNCTION Wrd$ ()
DECLARE FUNCTION Tts$ (x!, y!)
DIM SHARED SmpTot, SmpRec
DIM SHARED wa
DIM Typ(1 TO 5)
OpenSamples
OPEN "lingo.dat" FOR INPUT AS #2
   DO UNTIL EOF(2)
      LINE INPUT #2, a$
      wa = wa + 1
   LOOP
CLOSE #2
DO
   CLS
   Woord$ = Wrd$
   Typ(1) = 1
   FOR a = 2 TO 5: Typ(a) = 0: NEXT a
   COLOR 7
   PRINT "╔═══╦═══╦═══╦═══╦═══╗     Punten:"; Punten
   PRINT "║   ║   ║   ║   ║   ║ 50p"
   PRINT "╠═══╬═══╬═══╬═══╬═══╣"
   PRINT "║   ║   ║   ║   ║   ║ 40p"
   PRINT "╠═══╬═══╬═══╬═══╬═══╣"
   PRINT "║   ║   ║   ║   ║   ║ 30p"
   PRINT "╠═══╬═══╬═══╬═══╬═══╣"
   PRINT "║   ║   ║   ║   ║   ║ 20p"
   PRINT "╠═══╬═══╬═══╬═══╬═══╣"
   PRINT "║   ║   ║   ║   ║   ║ 10p"
   PRINT "╚═══╩═══╩═══╩═══╩═══╝"
   FOR x = 1 TO 5
      LOCATE x * 2, 1
      PRINT "║";
      FOR a = 1 TO 5
         IF Typ(a) = 1 THEN COLOR 0, 6: a$ = MID$(Woord$, a, 1) ELSE COLOR 7, 0: a$ = " "
         IF Typ(a) > 1 THEN b = Typ(a) - 1: a$ = MID$(Woord$, b, 1): COLOR 6, 0
         PRINT " "; a$; " ";
         COLOR 7, 0: PRINT "║";
      NEXT a
      COLOR 31
      PRINT STR$(60 - (x * 10)); "p"
      COLOR 7
      a$ = Tts$(x, 3) + Tts$(x, 7) + Tts$(x, 11) + Tts$(x, 15) + Tts$(x, 19)
      FOR a = 1 TO 5
         b$ = MID$(a$, a, 1)
         IF b$ = MID$(Woord$, a, 1) THEN Typ(a) = 1
      NEXT a
      Ant$ = a$
      LOCATE x * 2, 1
      PRINT "║";
      FOR a = 1 TO 5
         a$ = MID$(Ant$, a, 1)
         b$ = MID$(Woord$, a, 1)
         IF a$ = b$ THEN COLOR 0, 6 ELSE COLOR 7, 0
         PRINT " "; a$; " ";
         COLOR 7, 0: PRINT "║";
      NEXT a
      PRINT STR$(60 - (x * 10)); "p"
      IF Woord$ = Ant$ THEN Points = 60 - (x * 10): x = 5
   NEXT x
   LOCATE 12, 1
   PRINT "Het was "; Woord$
   PRINT LTRIM$(STR$(Points)); " punten"
   Toets
   Punten = Punten + Points
   PRINT "Nog een keer [J/N]? ";
   x = CSRLIN
   y = POS(1)
   a$ = ""
   DO
      a$ = Tts$(0, 0)
   LOOP WHILE a$ <> "J" AND a$ <> "N"
LOOP WHILE a$ = "J"
CLS

SUB OpenSamples
   OPEN "LINGO.SMP" FOR INPUT AS #1
      DO UNTIL EOF(1)
         INPUT #1, Smp$
         SmpTot = SmpTot + 1
      LOOP
   CLOSE #1
   OPEN "LINGO.SMP" FOR INPUT AS #1
END SUB

SUB Toets
   COLOR 31
   PRINT "<TOETS>"
   COLOR 7
   DO
      ToetsInp$ = UCASE$(INKEY$)
      SmpRec = SmpRec + 1
      IF SmpRec = SmpTot THEN
         CLOSE #1
         OPEN "LINGO.SMP" FOR INPUT AS #1
         SmpRec = 0
      END IF
      INPUT #1, Smp$
      PLAY Smp$
      LOOP WHILE ToetsInp$ = ""
END SUB

FUNCTION Tts$ (x, y)    'Geeft een letter door
   IF x <> 0 AND y <> 0 THEN LOCATE x * 2, y
   LOCATE , , 1, 0, 7
   DO
      'IF TtsInp$ <> "" THEN PLAY "l64t255o3 bagdad"
      DO
         TtsInp$ = UCASE$(INKEY$)
         SmpRec = SmpRec + 1
         IF SmpRec = SmpTot THEN
            CLOSE #1
            OPEN "LINGO.SMP" FOR INPUT AS #1
            SmpRec = 0
         END IF
         INPUT #1, Smp$
         PLAY Smp$
      LOOP WHILE TtsInp$ = ""
      TtsAsc = ASC(TtsInp$)
   LOOP WHILE TtsAsc > 90 OR TtsAsc < 65
   LOCATE CSRLIN, POS(1) - 1: PRINT " "; TtsInp$; " "
   LOCATE , , 0, 6, 7
   Tts$ = TtsInp$
END FUNCTION

FUNCTION Wrd$     'Geeft een woord door
   RANDOMIZE TIMER
   wrdnum = INT(RND * wa) + 1
   wrdopn = FREEFILE
   OPEN "lingo.dat" FOR INPUT AS #wrdopn
      FOR wrdtel = 1 TO wrdnum
         LINE INPUT #wrdopn, wrdinp$
      NEXT wrdtel
   CLOSE #wrdopn
   Wrd$ = UCASE$(wrdinp$)
END FUNCTION