Spell That Word

This file is part of and CATS Library Tape 10. Download the collection to get this file.
Developer(s): George Chambers
Date: 198x
Type: Program
Platform(s): TS 2068

“Spell That Word” is a multiple-choice spelling quiz that presents one of three word-difficulty levels (Hard, Medium, Easy), reading 30 word-triples from DATA statements where the first entry in each triple is always the correct spelling. At each question the subroutine at line 6000 picks a random word not recently used, then shuffles which of the three positions (correct, misspelling A, misspelling B) maps to options 1–3, storing the shuffled selection in the string array d$(). After 30 questions the player’s score is displayed with a conditional-expression technique to print one of three achievement messages. The program includes a SAVE command at line 9998 with an autostart LINE parameter, and placeholder stubs at lines 2000–4000 indicate that the Medium and Easy word lists were never completed.


Program Structure

The program is divided into clearly separated phases:

  1. Lines 100–240: initialisation — arrays, variables, RANDOMIZE
  2. Lines 500–650: title screen and menu, directing flow via RESTORE VAL i$*300+7700
  3. Lines 1000–1200: main quiz loop — reads 30 triples, calls display subroutine, scores answers
  4. Lines 6000–6200: word-selection and answer-shuffle subroutine
  5. Lines 8010–8890: DATA statements (the only populated word list)
  6. Lines 9997–9998: STOP and SAVE with autostart

Lines 2000, 3000, and 4000 are stub placeholders that print a message and STOP, meaning only the Hard difficulty (data starting near line 8010) is functional. Line 5000 simply jumps to the quit routine at 9900, which is not defined anywhere in the listing — a latent bug.

Menu and RESTORE Technique

The menu choice is converted to a DATA pointer with the expression RESTORE VAL i$*300+7700 at line 650. For menu option “1” this evaluates to RESTORE 8000, placing the READ pointer just before the first Hard-level DATA line. Options “2” and “3” would land at lines 8300 and 8600 respectively within the same block. This is a compact idiom that avoids a chain of IF statements for directing data reads.

Note that VAL i$ is used elsewhere (line 1120) to convert a single-character INKEY$ to a numeric index — a standard Sinclair BASIC idiom.

Word Selection and Anti-Repeat Logic

The subroutine at line 6000 uses array z(30) to track recently shown word indices, preventing immediate repeats:

  • Line 6010 picks a random integer e in 1–30.
  • Lines 6020–6030 scan z(); if e is already present the pick is retried.
  • Line 6040 records e into slot r; when r reaches 28 the history array is reset with DIM z(30), clearing all remembered indices.

Because the quiz only shows 30 words total (line 1140 checks m=30) and the history buffer holds 27 entries before reset, every question within a single 30-word session should be unique in practice.

Answer Shuffling

The subroutine also randomises which of the three strings (correct spelling a$(e), misspelling b$(e), misspelling c$(e)) appears at display positions 1, 2, and 3. Array w(3) tracks which source indices have been used, while y counts the position being filled:

  • Line 6110 picks a random f in 1–3.
  • Lines 6120–6130 reject duplicates, then line 6140 stores the choice.
  • Lines 6145 dispatches via computed GO SUB 6150+f — an arithmetic GO SUB that acts as a three-way branch to lines 6151, 6152, or 6153.
  • Each of those lines prints the appropriate string, stores it in d$(y) for answer checking, and returns.

Line 6150 is a fall-through GO TO 6110 that is only reached if f happened to equal 0 (impossible given the RND expression) — effectively dead code.

Answer Checking and Scoring

Line 1120 reads a fresh INKEY$ rather than the already-captured i$ from line 1115, creating a race condition: if the user’s finger has lifted, VAL INKEY$ will attempt VAL "" and cause an error. The intent was clearly LET i=VAL i$. The correct spelling is always a$(e); the check d$(i)=a$(e) works because d$() holds the shuffled display strings, so position i may or may not be the correct one depending on the shuffle result.

Score Reporting and Conditional Strings

Line 1142 uses the Sinclair BASIC boolean-string idiom (string AND condition) to conditionally print one of three feedback messages without any IF statements. When the condition is false the expression evaluates to "" and nothing is printed; when true the string is printed. The three thresholds are: ≥28 correct (“excellent”), 26–27 (“Very good”), and ≤25 (“You can do better”).

Data Quality Issues

Several anomalies exist in the DATA block:

  • Lines 8030 and 8720 both contain the triple for “catechism” — an exact duplicate.
  • Lines 8040 and 8740 both contain “antonym” — another exact duplicate.
  • Lines 8080 and 8610 both list “desiccate” as the correct form, but with the misspellings swapped between the two entries. The first triple (8080) gives “dessicate” as correct, which is itself a misspelling.
  • Line 8490 lists “garrulus” as the correct form, but the standard spelling is “garrulous”.
  • Line 8870 contains “chaise longe” as the correct answer; the accepted English phrase is “chaise longue”.

Because only lines 8010–8300 (the first 30 triples) are read for the Hard level (the only working difficulty), many of the later data errors would not be encountered during normal play.

Array Dimensions

ArrayDimensionsPurpose
a$(30,15)30 strings × 15 charsCorrect spellings
b$(30,15)30 strings × 15 charsFirst misspelling
c$(30,15)30 strings × 15 charsSecond misspelling
d$(3,15)3 strings × 15 charsShuffled display options
z(30)30 numericsRecent word history
w(3)3 numericsShuffle state (local to subroutine)
x(3)3 numericsDeclared but never used

The 15-character string width is sufficient for most words in the list but would silently truncate any word longer than 15 characters (e.g., “embarrass” fits at 9, but “dissatisfied” at 12 also fits). “avoirdupois” at 11 characters fits, but the DATA entry “avoirdupois” is 11 chars — within the limit.

Content

Appears On

Capital Area Timex Sinclair User Group’s Library Tape.

Related Products

Related Articles

Related Content

Image Gallery

Spell That Word

Source Code

    1 REM 
    2 REM      SPELL THAT WORD
    3 REM 
    4 REM  An original program                  written by    
    5 REM   G.F.Chambers 1985
    6 REM 
  100 BORDER 3: PAPER 7: INK 1: CLS 
  200 DIM a$(30,15): DIM b$(30,15): DIM c$(30,15)
  210 DIM d$(3,15)
  220 DIM z(30): DIM x(3)
  230 LET r=1
  240 RANDOMIZE 
  500 PRINT 'TAB 8;"SPELL THAT WORD"
  510 PRINT AT 1,8; OVER 1;"_______________"
  515 PRINT 'TAB 8;"By G F Chambers"
  520 PRINT '';"   MENU:"
  530 PRINT '"   1) Hard"
  540 PRINT '"   2) Medium"
  550 PRINT '"   3) Easy"
  570 PRINT '"   4) To save program"
  600 PRINT ''"     Enter a number (1-4)"
  610 IF INKEY$="" THEN GO TO 610
  620 LET I$=INKEY$: IF I$<"1" OR i$>"4" THEN GO TO 610
  630 IF INKEY$<>"" THEN GO TO 640
  640 IF i$="4" THEN GO TO 9900
  650 RESTORE VAL i$*300+7700
  660 LET k=0: LET m=0
 1000 FOR n=1 TO 30: READ a$(n): READ b$(n): READ c$(n): NEXT n
 1050 CLS : PRINT AT 1,2;"Which of the following words    is spelled correctly"''
 1060 GO SUB 6000
 1070 LET m=m+1: PRINT ''"   Enter the number (1,2,or 3)"
 1110 IF INKEY$="" THEN GO TO 1110
 1115 LET i$=INKEY$: IF i$<"1" OR i$>"3" THEN GO TO 1110
 1120 LET i=VAL INKEY$: IF d$(i)=a$(e) THEN PRINT ''TAB 8; INK 2; FLASH 1;"That is correct"; FLASH 0; INK 0: LET k=k+1: GO TO 1140
 1130 PRINT '' INK 2; FLASH 1;"Wrong!!"; FLASH 0; INK 0;"  The correct spelling is"''TAB 13;a$(e)
 1140 IF m=30 THEN CLS : PRINT AT 10,2;"You have ";k;" correct out of 30"
 1142 IF m=30 THEN PRINT : PRINT TAB 5; INK 2; FLASH 1;("That was excellent work" AND k>=28): PRINT TAB 11; INK 2; FLASH 1;("Very good" AND k>25 AND k<28): PRINT TAB 2; INK 2; FLASH 1;("You can do better than that" AND k<=25): FLASH 0
 1145 PRINT '"Press any key for next word set",,,"   or ""m"" to return to menu": PAUSE 0
 1150 LET i$=INKEY$: IF i$="m" THEN CLS : GO TO 100
 1200 GO TO 1050
 2000 CLS : PRINT "Needs additional word list here": STOP 
 3000 CLS : PRINT "Needs additional word list here": STOP 
 4000 CLS : PRINT "Needs additional word list here": STOP 
 5000 GO TO 9900
 6000 DIM w(3)
 6010 LET e=INT (RND*30+1)
 6020 FOR n=1 TO 30: IF e=z(n) THEN GO TO 6010
 6030 NEXT n
 6040 LET z(r)=e: LET r=r+1: IF r=28 THEN DIM z(30): LET r=1
 6100 LET y=1: DIM w(3)
 6110 LET f=INT (RND*3+1)
 6120 FOR n=1 TO 3: IF f=w(n) THEN GO TO 6110
 6130 NEXT n
 6140 LET w(y)=f
 6145 GO SUB 6150+f
 6147 LET y=y+1: IF y=4 THEN RETURN 
 6150 GO TO 6110
 6151 PRINT 'TAB 10;y;") ";a$(e): LET d$(y)=a$(e): RETURN 
 6152 PRINT 'TAB 10;y;") ";b$(e): LET d$(y)=b$(e): RETURN 
 6153 PRINT 'TAB 10;y;") ";c$(e): LET d$(y)=c$(e): RETURN 
 6160 LET y=y+1: IF y=3 THEN RETURN 
 6200 GO TO 6110
 8010 DATA "copyright","copywright","copywrite"
 8020 DATA "moccasin","mocassin","moccassin"
 8030 DATA "algebraic","algabraic","allgebraic"
 8040 DATA "antarctic","anarctic","anartic"
 8050 DATA "hormone","harmoan","harmone"
 8060 DATA "athletic","atheletic","athaletic"
 8070 DATA "rhinoceros","rhinocerous","rhinocerus"
 8080 DATA "supersede","supracede","supercede"
 8090 DATA "monocle","monicle","monacle"
 8100 DATA "gargoyles","gargoiles","gargoylls"
 8110 DATA "calendar","calander","calandar"
 8120 DATA "auxiliary","auxilliary","auxillary"
 8130 DATA "average","averege","avarage"
 8140 DATA "battalion","battallion","batallion"
 8150 DATA "buoyant","bouyant","buoyent"
 8160 DATA "embarrass","embarras","embarass"
 8170 DATA "sergeant","sargeant","sargent"
 8180 DATA "diphthong","dipthong","difthong"
 8190 DATA "parliament","parlament","parliment"
 8200 DATA "rhythmic","rhithmic","rythmic"
 8210 DATA "almanac","almanack","almanak"
 8220 DATA "dessicate","dessiccate","desiccate"
 8230 DATA "mucilage","mucilege","musilage"
 8240 DATA "religious","religeous","religous"
 8250 DATA "valise","vallise","valaise"
 8260 DATA "cinnamon","cinamon","cinnomon"
 8270 DATA "larynx","larnyx","larinx"
 8280 DATA "licorice","licorish","licoriss"
 8290 DATA "mahogany","mahagony","mahogony"
 8300 DATA "meringue","merang","meraingue"
 8310 DATA "fluorescent","fleurescent","flourescent"
 8320 DATA "graffiti","grafitti","graphitti"
 8330 DATA "hierarchy","heirarchy","heirarcky"
 8340 DATA "homogeneous","homagenous","homogenous"
 8350 DATA "anomaly","anomoly","anomely"
 8360 DATA "bailiwick","bailliwick","bailewick"
 8370 DATA "asphyxiate","asphixiate","asphixeate"
 8380 DATA "bureaucracy","burocracy","beurocracy"
 8390 DATA "bailiff","ballif","bailliff"
 8400 DATA "capillary","capilliary","cappiliary"
 8410 DATA "caffeine","caffiene","caffeinne"
 8420 DATA "carburetor","carborettor","carburetter"
 8430 DATA "catechism","catachism","catichism"
 8440 DATA "antonym","antonim","antenym"
 8450 DATA "acquittal","aquittal","acquital"
 8460 DATA "accessible","accessable","accesable"
 8470 DATA "finesse","finnesse","finnese"
 8480 DATA "exaggerate","exagerrate","exagirate"
 8490 DATA "garrulus","garralous","garallus"
 8500 DATA "bacillus","baccillus","baccilus"
 8510 DATA "bourgeois","bourgois","bourgious"
 8520 DATA "deciduous","deceduous","decidous"
 8530 DATA "euthanasia","euthenasia","euthanazia"
 8540 DATA "facsimile","faccimile","facsimele"
 8550 DATA "diaphragm","diaphram","diaphrem"
 8560 DATA "disappear","dissappear","dissapear"
 8570 DATA "exorbitant","exhorbitant","exorbetant"
 8580 DATA "emphysema","emphasema","emphesema"
 8590 DATA "empirical","emperical","empirecal"
 8600 DATA "hirsute","hirsuite","hersute"
 8610 DATA "desiccate","dessicate","dessiccate"
 8620 DATA "chassis","chassiss","chasiss"
 8630 DATA "hologram","holegram","holagram"
 8640 DATA "asylum","asyllum","asylem"
 8650 DATA "dissatisfied","disatisfied","disattisfied"
 8660 DATA "fallacy","falacy","fallicy"
 8670 DATA "harass","harrass","harras"
 8680 DATA "burglar","burgler","berglar"
 8690 DATA "erroneous","eronneous","erroneus"
 8700 DATA "digital","diggital","digittal"
 8710 DATA "binary","binery","binnary"
 8720 DATA "catechism","catachism","catichism"
 8730 DATA "envelope","envellope","envellop"
 8740 DATA "antonym","antonim","antenym"
 8750 DATA "affidavit","affadavit","affidavet"
 8760 DATA "diaphragm","diaphram","diaphregm"
 8770 DATA "acoustic","accoustic","accustic"
 8780 DATA "apparel","aparrel","aparrell"
 8790 DATA "empirical","empirrical","empirecal"
 8800 DATA "aging","ageing","aggeing"
 8810 DATA "analyse","analise","analyze"
 8820 DATA "feasibility","feasability","feasebility"
 8830 DATA "braille","braelle","braile"
 8840 DATA "culinary","cullinary","culinery"
 8850 DATA "assessor","assesser","assesor"
 8860 DATA "avoirdupois","avordupois","avourdupoise"
 8870 DATA "chaise longe","chaise lounge","chase longe"
 8880 DATA "caffeine","caffiene","caffeinne"
 8890 DATA "dinosaur","dinasaur","dinossaur"
 9997 STOP 
 9998 SAVE "spelling" LINE 10

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

Scroll to Top