This program is a two-way vocabulary quiz that tests the user on word pairs stored in parallel string arrays, supporting both English-to-foreign and foreign-to-English directions. The language name is held in the variable `L$`, and word pairs are stored in `E$()` (English) and `F$()` (foreign), with `W` holding the total word count — all presumably initialized in an earlier, not-listed portion of the program. A previously-answered-word tracking mechanism uses array `C$()` and counter `Q` to prevent repeating questions within a single round. Correct answers are displayed in a decorative tiled pattern using nested `FOR` loops with `PRINT AT` across multiple screen positions. The program auto-saves itself with `SAVE “SPANBLDR1” LINE 85` to preserve the vocabulary data between sessions.
Program Analysis
Program Structure
This listing is a fragment of a larger vocabulary-building program (the name “SPANBLDR1” in the SAVE command suggests a Spanish vocabulary builder). Lines before 86 are not shown but presumably handle initialization of L$, E$(), F$(), W, and C$(). The visible code divides into three logical blocks:
- Lines 86–135: Main menu and round control loop
- Lines 700–820: Subroutine — English-to-foreign quiz
- Lines 900–1015: Subroutine — Foreign-to-English quiz
Variable Usage
| Variable | Purpose |
|---|---|
L$ | Name of the target language (e.g., “SPANISH”) |
E$() | Array of English words |
F$() | Array of foreign-language words |
W | Total number of word pairs |
Q | Count of words answered in the current round |
C$() | Array recording already-used words to prevent repeats |
R | Randomly selected word index |
CH | User’s menu choice (1 or 2) |
A$ | User’s input answer (collected but not evaluated) |
Anti-Repeat Mechanism
Both quiz subroutines use a linear scan of the C$() array to ensure that a randomly selected word has not already been tested in the current round. In subroutine 700 (lines 715–725), if F$(R) matches any previously stored C$(P), a new random index is chosen by jumping back to line 705. The same logic appears at lines 910–920 in subroutine 900, checking E$(R) against C$(P). This is a simple but effective guard against repetition, though it could loop indefinitely if W is small and all words have been used — a condition that should not occur because the round ends when Q=W.
Answer Display — Tiled Pattern
After revealing the correct answer, both subroutines display the answer word tiled across the screen using nested FOR loops (lines 783–785 and 976–978). The outer loop steps Y from 0 to 30 in steps of 12 (columns), and the inner loop steps X from 10 to 20 in steps of 2 (rows), printing the word at each intersection with PRINT AT X,Y. This creates a decorative grid of repeated correct answers as visual reinforcement.
Bugs and Anomalies
- Answer is never checked: In both subroutines, the user’s input is stored in
A$but is never compared to the correct answer. The program always reveals the correct answer unconditionally. There is no right/wrong feedback, score tracking, or differentiation between correct and incorrect responses. - Subroutine 900 never increments
Qor stores toC$()via its own path: Lines 1000–1015 handle theQincrement andC$(Q)assignment for Test 2, but line 986 jumps directly back to line 900 (GO TO 900) without passing through line 1000. This meansQis never incremented in the foreign-to-English test, and the round-complete conditionQ=Wat line 1005 is never reached. The Test 2 subroutine effectively loops forever and never returns. - Line 130 / 135 keypress logic:
PAUSE 0at line 127 waits for any key, but lines 130 and 135 then readINKEY$in sequential statements. SincePAUSE 0resumes on any keypress and the key may no longer be held, theINKEY$reads at 130 and 135 may both return empty string, causing neither branch to execute and the program to fall through to theSTOPat line 9997. - Line 135 prints
240as a literal number:PRINT 240outputs the numeric value 240, which appears to be a mistake — likely intended to be a string message or a line reference that was incorrectly coded. - Line 130 references
GO TO 90but the listing begins at line 86, suggesting line 90 exists in the unlisted initialization section.
Key BASIC Idioms
- Delay loop via
FOR D=1 TO 200: NEXT Dat line 800 — a busy-wait timing technique. PAUSE 90at line 980 provides a fixed ~1.6-second pause before continuing.INT (W*RND)+1produces a random integer in the range 1 toW, the standard idiom for selecting a random array index.
Content
Source Code
86 BORDER 3: INK 0: PAPER 6
92 CLS
95 LET Q=0: LET G=0
100 PRINT "1)ENGLISH TO ";L$;"?"
105 PRINT "2)";L$;" TO ENGLISH?"
110 INPUT "CHOICE--1 OR 2?";CH
115 IF CH=1 THEN GO SUB 700
120 IF CH=2 THEN GO SUB 900
125 PRINT "YOU HAVE COMPLETED A ROUND",," DO YOU WANT TO DO MORE?(Y/N)"
127 PAUSE 0
130 IF INKEY$="Y" THEN GO TO 90
135 IF INKEY$<>"Y" THEN PRINT "AUTO SAVE WILL PRESERVE VOCABULARY": PRINT 240: GO TO 1020
700 REM TEST 1
705 LET R=INT (W*RND)+1
710 REM TO CHECK PREVIOUS ANSWERS
715 FOR P=1 TO Q
720 IF F$(R)=C$(P) THEN GO TO 705
725 NEXT P
730 CLS
735 PRINT "ENGLISH WORD: ";E$(R)
740 INPUT "TRANSLATION? ";A$
780 PRINT "THE MEANING OF ";E$(R),,"IS",,F$(R)
783 FOR Y=0 TO 30 STEP 12: FOR X=10 TO 20 STEP 2
784 PRINT AT X,Y;F$(R);
785 NEXT X: NEXT Y
800 FOR D=1 TO 200: NEXT D
801 CLS
805 LET Q=Q+1: LET C$(Q)=F$(R)
810 IF Q=W THEN GO TO 820
815 GO TO 700
820 RETURN
900 REM TEST 2
905 LET R=INT (W*RND)+1
910 FOR P=1 TO Q
915 IF E$(R)=C$(P) THEN GO TO 905
920 NEXT P
925 CLS
930 PRINT L$;" WORD: ";F$(R)
935 PRINT "ENGLISH EQUIVALENT: "
940 INPUT A$
975 PRINT "THE MEANING OF",,F$(R),," IS ",,E$(R)
976 FOR Y=0 TO 30 STEP 12: FOR X=10 TO 20 STEP 2
977 PRINT AT X,Y;E$(R)
978 NEXT X: NEXT Y
980 PAUSE 90
986 GO TO 900
1000 LET Q=Q+1: LET C$(Q)=E$(R)
1005 IF Q=W THEN GO TO 1015
1010 GO TO 900
1015 RETURN
9997 STOP
9998 SAVE "SPANBLDR1" LINE 85
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
