Word Play I is a two-game educational package combining Hangman and Anagrams for vocabulary practice. The program ships with ten built-in word categories—colors, U.S. states, countries, foods, clothing, flowers, animals, trees, birds, and a mixed bag—plus the ability for users to enter their own custom word lists of up to 20 letters per word. The Hangman routine draws a gallows and incrementally renders a figure using user-defined graphics (UDGs), tracking which letters have already been guessed via a 26-character string. The Anagrams mode shuffles the selected word using random index swapping and presents a letter-by-letter guessing interface. Machine code is saved and loaded via a companion CODE block (line 9900), and an ON ERR handler at line 4002/9990 provides basic crash recovery.
Program Analysis
Program Structure
The program is organized into broad functional blocks by line number range:
- Lines 1–56: Initialization, title screen, and top-level game selection.
- Lines 100–230: Word-category menu, user word-list entry, and routing to the chosen game.
- Lines 500–520: Shared score/display subroutine used by both games.
- Lines 1200–2000: Hangman figure drawing subroutines, each adding one body part.
- Lines 2030–2100: Word-selection engine that parses the packed word string.
- Lines 2510–2594 / 2570–2594: Ten word-list data subroutines (one per category, spaced 10 lines apart and called via
GO SUB 2500+10*(CODE W$-64)). - Lines 3000–3060: Letter-reveal subroutine and “already entered a list” guard.
- Lines 4000–4042: Animated splash/intro screen with circle-fill graphics and BEEP fanfare.
- Lines 5000–5232: Hangman game loop including gallows display, letter guessing, and end-of-round options.
- Lines 7000–7100: Anagrams game loop including jumbling animation and letter-by-letter answer entry.
- Lines 9899–9993: Save/load utility, error-recovery handlers.
Word Storage and Retrieval
All word lists are stored as a single packed string with run-length numeric prefixes: e.g., "1indigo2maroon3red...". The word-selection subroutine at lines 2030–2100 picks a random index R1, then scans the string for the matching numeric prefix, extracts the word into A$, and sets Q to its length. This avoids arrays entirely and keeps all data in simple string variables.
The subroutine uses LEN STR$ R1 (stored in C1) to determine how many characters the prefix occupies, correctly handling both single- and double-digit numbers. A guard at line 2033 prevents the same word being selected twice in a row by comparing R1 to R2.
Category Dispatch
The ten built-in categories (A–J) are called with a single computed GO SUB:
GO SUB 2500+10*(CODE W$-64)
Since CODE "A"=65, category A maps to line 2510, B to 2520, and so on through J at 2600 (though J is intercepted at line 106 for the “mixed bag” random pick). This is a clean dispatch table implemented without any explicit branching per option.
The “mixed bag” option (J) uses GO SUB 2510+10*INT(RND*N) with N=9 to pick randomly from the first nine categories. User lists are stored in o$ and accessed via a separate branch at line 107.
Hangman Drawing Subroutines
Each body part is a separate subroutine entered from a base of GO SUB 1200+L*100, where L counts down from 8. The subroutines fall through to RETURN at line 2000, meaning each higher-numbered subroutine also prints all parts below it (earlier subroutines). This is intentional: calling line 1200 prints only the feet, calling 1900 prints the post alone, and calling 2000 (at full lives) returns immediately. As lives decrease, lower subroutine numbers are called, adding more body parts cumulatively without any loop or array.
The body parts use UDG characters (\a through \k) defined by the machine code block saved at line 9900, as well as standard block-graphic characters for structural elements like the gallows post and beam.
Hangman Game Loop
The guessing interface at lines 5044–5084 tracks the 26 letters via H$="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; when a letter is guessed, its corresponding character is replaced with a space (line 5230). If the slot is already a space, the repeat-guess message is shown and F1 is set to suppress the life deduction. The current word state is held in C$, which starts as all spaces and has characters revealed as correct guesses are made via the subroutine at line 3000.
Case normalization at line 5073 ensures guesses match the stored word regardless of whether the word list is uppercase or lowercase: b$=CHR$(CODE b$+(32*(a$(1)>"`"))-(32*(b$>"`"))).
Anagrams Game Loop
The jumbling at lines 7032–7047 performs Q random swap operations on a copy Y$ of the answer A$, with a guard at line 7047 to retry if the shuffle produced no change. The guessing at lines 7058–7086 proceeds letter by letter in order, prompting for each non-space character. After a correct guess the matching letter in Y$ is blanked to “*” (line 7085), removing it from the on-screen jumble display.
The wrong-guess counter NG is displayed live and used only for the congratulatory message; there is no penalty or life system in Anagrams.
User Word-List Entry
Lines 130–230 provide a full interactive word-entry system. Words are appended to X$ in the same packed format as the built-in lists (STR$ I + W$), allowing the same retrieval engine at lines 2030–2100 to handle them transparently. The user can choose uppercase or lowercase input; the flag q controls case conversion at lines 195–196. A guard at line 3050 prevents re-entry of a list without restarting the program, since o$ persists for the session.
Intro Screen and Machine Code
The animated intro at lines 4000–4042 uses CIRCLE and PLOT/DRAW to fill a circle region. The inner loop at lines 4003–4007 scans each row of the circle with POINT to find the edge pixel, then draws a horizontal span, producing a filled-circle effect without a fill routine. The ON ERR GO TO 9990 at line 4002 catches any graphics overflow during this section.
Line 9900 saves the BASIC program as "wordplay1" with LINE 9902 for auto-start, then saves a 168-byte machine code block from USR "a" (the UDG area) as a headerless CODE file. Line 9902 reloads it and jumps to the intro at line 4000.
Error Handling
Three ON ERR statements appear at lines 4002, 9990, 9992, and 9993. Line 4002 routes graphics errors during the circle-fill intro to the recovery block. Lines 9990–9993 form a chain: RESET to clear error state, a short PAUSE, then ON ERR GO TO 9990 to loop, and finally ON ERR CONTINUE to attempt resumption.
Notable Bugs and Anomalies
- Line 54 reads
INKEY$intog$(lowercase) but testsG$(uppercase). On the ZX Spectrum, variable names are case-sensitive, soG$andg$are distinct variables.G$is never assigned here, so the conditionG$<"1" OR G$>"2"will always be true (empty string), causing an infinite loop. This is a definite bug; the subsequent use of bothG$andg$interchangeably throughout the program (lines 56, 107, 122, 5206, 5212, etc.) suggests the author treated them as the same variable. - The Animals list at line 2570 contains
16missing (the sequence jumps from 15 to 17), yetR=30. The word-retrieval engine searches for the numeric prefix literally, so word 16 will never be found; thephew!!!fallback at line 2044 would fire and the loop would seek backward—potentially hanging. MISSISSIPI(line 2520) is misspelled; the correct spelling is MISSISSIPPI.- Line 7094 contains a stray
NEXT Jthat has no matchingFOR Jwithin the Anagrams loop’s own scope at that point; the outerFOR J=1 TO Qat line 7054 is the intended pair, but the interveningNEXT Jat line 7086 already closes it. This extraNEXT Jwould cause a “No FOR found” error in practice. - The
TABcalls inside multi-segmentPRINTstatements at lines 100 and elsewhere useTAB 25after content that may already exceed column 25, which on the Spectrum would advance to the next line rather than staying on the current one—potentially misaligning the menu layout.
Content
Source Code
1 REM \::\::\::\::\::Wordplay 1\::\::\::\::\:: Hangman\::\::\::\::\::Anagrams
2 REM \::\::ZX Spectrum - 48K
3 REM \* FISHER-MARRIOTT \ \::\::\::\::\::\::\::\::\::\::\::\::\ \ \ \ \ \ 1983 \ \ \ \ \ \ \
5 LET R2=0
6 LET CG=0
7 LET N=9
9 LET o$="": LET P$="\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u\u"
50 CLS : PRINT AT 0,3;"\: \: \. \: \ .\: ";TAB 3;"\: \: \: \: \: \: ";TAB 3;"\: \: \: \r\s\t\q\' \r\s\: \q\s\t\: \r\s\: \: \: \: ";TAB 3;"\: \: \: \: \: \: \: \: \: \: \: \: \: \: \: \: ";TAB 3;"\o\p\o\p\c\o\p\c\: \o\p\: \u\p\c\o \o\p\: \o\p\: \: ";
51 PRINT TAB 16;"\: \: ";TAB 16;"\: \o\p\c"
52 PRINT AT 12,5;"Press";AT 14,5;"1 For Hangman";AT 16,5;"2 For Anagrams"
54 LET g$=INKEY$: IF G$<"1" OR G$>"2" THEN GO TO 54
56 LET Z$=("Hangman" AND G$="1")+("Anagrams" AND G$="2"): IF g$="2" THEN GO TO 7000
100 CLS : PRINT " "; PAPER 8;" ";Z$;AT 3,0;" "; PAPER 8;" ";"Choose a set of words";AT 6,5;"A Colors";TAB 25;AT 7,5;"B States of America";TAB 25;AT 8,5;"C Countries";TAB 25;AT 9,5;"D Foods";TAB 25;AT 10,5;"E Things to wear";TAB 25;AT 11,5;"F Flowers";TAB 25;AT 12,5;"G Animals";TAB 25;AT 13,5;"H Trees";TAB 25;AT 14,5;"I Birds";TAB 25;AT 15,5;"J A mixed bag";TAB 25;AT 16,5; PAPER 8;"K Your own list" AND o$>"";TAB 25;AT 19,4;"or Press 0";AT 21,4;"to put in ";"a new" AND o$>"";"your own" AND o$="";" word list"
103 LET W$=INKEY$
104 IF W$="0" THEN GO TO 130
105 LET w$=CHR$ (CODE w$-32*(CODE w$>96))
106 IF W$="J" THEN GO TO 122
107 IF w$="K" AND o$>"" THEN LET x$=o$: LET n$="word from your list": LET r=ro: GO TO 122
108 IF W$<"A" OR W$>"I" THEN GO TO 103
110 GO SUB 2500+10*(CODE W$-64)
122 IF G$="1" THEN GO TO 5000
124 GO TO 7020
130 IF o$<>"" THEN GO TO 3050
131 CLS : PRINT "\::\::\:: ";Z$;AT 5,0;"\::\:: You may enter words";AT 6,0;"\::\:: in CAPITALS,";TAB 22;AT 8,0;"\::\:: or in lower-case";TAB 22;AT 9,0;"\::\:: (small letters).";TAB 22;AT 15,2;"Press C for CAPITALS";TAB 24;AT 16,7;" L for lower-case";TAB 24
132 LET q$=INKEY$: IF q$<>"c" AND q$<>"C" AND q$<>"l" AND q$<>"L" THEN GO TO 132
133 LET q$=CHR$ (CODE q$-32*(CODE q$>96))
134 LET q=q$="C": PRINT PAPER 7;AT 19,0;"You have chosen ";"CAPITALS." AND q;"lower-case." AND NOT q
135 PRINT PAPER 7;AT 21,0;"Press any key to continue."
136 IF INKEY$>"" THEN GO TO 136
137 IF INKEY$="" THEN GO TO 137
150 CLS : PRINT "\::\::\:: ";Z$;AT 5,0;"\::\:: You may";TAB 23;AT 6,0;"\::\:: enter";TAB 23;AT 7,0;"\::\:: any number of words.";AT 14,0;"\::\:: Each word";TAB 23;AT 15,0;"\::\:: may contain";TAB 23;AT 16,0;"\::\:: from three to";TAB 23;AT 17,0;" twenty letters,";TAB 23;AT 18,0;"\::\:: including spaces.";TAB 23
154 PRINT PAPER 7;AT 21,0;"Press any key when ready."
156 IF INKEY$="" THEN GO TO 156
158 CLS
160 PRINT "\::\::\:: ";Z$;AT 3,0;"\::\:: Press ENTER,";AT 4,0;"\::\:: to end a word"
162 PRINT AT 6,0;"\::\:: Press DELETE,";AT 7,0;"\::\:: if you make a mistake"
164 PRINT AT 9,0;"\::\:: Press 1,";AT 10,0;"\::\:: to end the list"
165 PRINT PAPER 7;AT 14,0;"Press any key when ready."
166 IF INKEY$>"" THEN GO TO 166
167 IF INKEY$="" THEN GO TO 167
168 PRINT AT 14,0;TAB 31
169 LET X$=""
170 LET I=1
171 LET R=0
172 PRINT PAPER 7;AT 18,0;"Word ";I;" "
174 PRINT PAPER 7;AT 20,0;">::::::::::::::::::::<"; PAPER 8;TAB 31
176 LET P=1
178 LET W$=""
180 IF INKEY$<>"" THEN GO TO 180
182 PRINT AT 20,P;"#"
184 LET i$=INKEY$: IF I$="" THEN GO TO 184
185 BEEP .01,20: IF I$=CHR$ 13 AND LEN W$>2 THEN GO TO 210
186 IF (I$="0" OR i$=CHR$ 12) AND W$<>"" THEN LET w$=w$( TO LEN w$-1): PRINT AT 20,p;":": LET p=p-1: GO TO 180
188 IF I$=" " THEN GO TO 197
189 PRINT AT 20,P;"";I$;""
190 IF INKEY$<>"" THEN GO TO 190
191 IF I$="1" AND W$="" THEN GO TO 219
192 IF I$<"A" OR I$>"z" THEN GO TO 180
194 IF I$>"Z" AND I$<"a" THEN GO TO 174
195 IF NOT q THEN LET i$=CHR$ (CODE i$+32*(CODE i$<96))
196 IF q THEN LET i$=CHR$ (CODE i$-32*(CODE i$>96))
197 LET W$=W$+I$
198 IF LEN W$>20 THEN GO TO 174
199 PRINT AT 20,1;W$
200 LET P=P+1
207 GO TO 180+2*(I$="")
210 PRINT AT 20,P;":"
212 LET X$=X$+STR$ I+W$
214 LET R=I: LET ro=r
216 LET I=I+1
218 GO TO 172
219 IF R=0 THEN GO TO 100
220 IF LEN X$<3 THEN GO TO 169
221 LET o$=x$: CLS
222 PRINT AT 10,0;"\ \ "; PAPER 8;" Thank you for the words."'''"\ \ "; PAPER 8;" ";Z$; PAPER 8;" coming soon."
224 FOR I=1 TO 150
226 NEXT I
228 LET N$="word from your list"
230 GO TO 122
500 IF Q<16 THEN GO TO 510
502 IF NOT E THEN PRINT BRIGHT 1;AT 16,16-Q/2;A$;AT 17,16-Q/2;C$
504 IF E THEN PRINT PAPER 2;AT 16,16-Q/2;C$;AT 17,16-Q/2;A$
506 GO TO 520
510 IF NOT E THEN PRINT BRIGHT 1;AT 16,15-Q;A$;" ";C$
515 IF E THEN PRINT PAPER 2;AT 16,15-Q;C$;" ";A$
520 RETURN
1200 PRINT AT 9,18;"\g"
1205 PRINT AT 10,18;"\h"
1210 PRINT AT 11,17;"\i\j\k"
1300 PRINT AT 7,19;"\d"
1310 PRINT AT 8,19;"\f"
1400 PRINT AT 7,17;"\r"
1410 PRINT AT 8,17;"\e"
1500 PRINT AT 7,18;":"
1510 PRINT AT 8,18;":"
1600 PRINT AT 5,18;"\b"
1610 PRINT AT 6,18;"\a"
1700 PRINT AT 4,14;"\ .\..\..\..\..\.."
1800 PRINT AT 5,14;"\ :\q\' "
1810 PRINT AT 6,14;"\ :\' "
1820 PRINT AT 7,14;"\ :"
1900 PRINT AT 8,14;"\ :"
1910 PRINT AT 9,14;"\ :"
1920 PRINT AT 10,14;"\ :"
1930 PRINT AT 11,14;"\ :"
1940 PRINT AT 12,14;"\ :"
1950 PRINT AT 13,14;"\ :"
1960 PRINT AT 14,13;"\''\''\''\' "
2000 RETURN
2030 LET X=LEN X$
2032 BEEP .2,0: LET R1=INT (RND*R)+1: IF r=1 THEN GO TO 2035
2033 IF R1=R2 THEN GO TO 2032
2034 LET R2=R1
2035 LET C=(R1-1)*INT (X/R)-8
2036 LET C1=-1+LEN STR$ R1
2038 IF C<1 THEN LET C=1
2039 LET f=0: FOR i=C TO x: BEEP .01,RND*10+RND*10: IF x$(i TO i+c1)=STR$ r1 THEN LET f=1: LET c=i+c1+1: LET s=c: LET i=x
2040 NEXT i
2044 IF NOT f THEN PRINT AT 5,10;"phew!!!": LET c=c-10: GO TO 2038
2058 BEEP .01,RND*10-RND*10: LET C=C+1
2070 IF C>X THEN GO TO 2090
2072 IF X$(C)<":" AND X$(C)>"/" THEN GO TO 2090
2080 GO TO 2058
2090 LET A$=X$(S TO C-1)
2095 LET Q=LEN A$
2100 BEEP .2,0: RETURN
2510 LET X$="1indigo2maroon3red4blue5green6yellow7scarlet8violet9pink10orange11brown12white13black14gold15silver16purple17gray18fawn19sepia20cream"
2512 LET R=20
2514 LET N$="color"
2516 RETURN
2520 LET x$="1MAINE2NEW HAMPSHIRE3NEW YORK4CONNECTICUT5PENNSYLVANIA6OHIO7KENTUCKY8NEW JERSEY9WEST VIRGINIA10VIRGINIA11NORTH CAROLINA12SOUTH CAROLINA13TENNESSEE14ALABAMA15MISSISSIPI16ARKANSAS17LOUISIANA18MISSOURI19IOWA20MINNESOTA"
2521 LET X$=X$+"21OKLAHOMA22FLORIDA23TEXAS24KANSAS25NEBRASKA26NEW MEXICO27COLORADO28WYOMING29MONTANA30IDAHO31NEVADA32UTAH33ARIZONA34CALIFORNIA35OREGON36WASHINGTON37MARYLAND38MICHIGAN39VERMONT40WISCONSIN41HAWAII42ALASKA"
2522 LET R=42
2524 LET N$="state of America"
2526 RETURN
2530 LET X$="1FRANCE2SPAIN3PORTUGAL4ITALY5GERMANY6AUSTRIA7YUGOSLAVIA8IRELAND9NORWAY10HOLLAND11SWEDEN12BELGIUM13DENMARK14LUXEMBOURG15HUNGARY16BULGARIA17POLAND18RUMANIA19RUSSIA20GREECE"
2531 LET x$=x$+"21BURMA22INDIA23AUSTRALIA24CHINA25ZIMBABWE26BOLIVIA27ARGENTINA28JAPAN29CHILE30ISRAEL31LEBANON32TUNISIA33SUDAN34GHANA35URUGUAY36BRAZIL37VIETNAM38AFGHANISTAN39PAKISTAN40KOREA"
2532 LET R=40
2534 LET N$="country"
2536 RETURN
2540 LET X$="1sugar2honey3marmalade4toast5cornflakes6bacon7hamburger8sausage9turkey10tomatoes11bread12butter13margarine14lettuce15cucumber16apple17carrot18cookies19potato20chocolate"
2541 LET x$=x$+"21orange22banana23grapefruit24cabbage25beef26lamb27pork28egg29ham30cauliflower"
2542 LET R=30
2544 LET N$="food"
2546 RETURN
2550 LET X$="1dress2skirt3jumper4vest5socks6jacket7teeshirt8shoes9pants10shirt11blouse12tie13raincoat14sweater15sneakers16tracksuit17jeans18cardigan19slippers20pajamas"
2551 LET R=20
2552 LET N$="thing to wear"
2554 RETURN
2560 LET X$="1rose2pansy3carnation4daffodil5wallflower6buttercup7tulip8crocus9snowdrop10lily11daisy12morning glory13clematis14iris15poppy16dahlia17geranium18hyacinth19hydrangea20orchid"
2562 LET R=20
2563 LET N$="flower"
2564 RETURN
2570 LET X$="1bear2rhinoceros3hippopotamus4lion5leopard6kangaroo7wallaby8cheetah9monkey10chimpanzee11crocodile12tiger13panda14zebra15wolf17buffalo18deer19elephant20alligator21giraffe22gorilla23dingo24llama25camel"
2571 LET x$=x$+"26buffalo27rattlesnake28chipmunk29skunk30coyote"
2572 LET R=30
2573 LET N$="wild animal"
2574 RETURN
2580 LET X$="1beech2birch3elm4oak5hazel6sycamore7redwood"
2581 LET X$=X$+"8ash9pine10fir11cedar12poplar13willow14hickory15lime16cherry17maple18spruce19larch20sequoia21palm22chestnut23holly24balsa25walnut"
2582 LET R=25
2583 LET N$="tree"
2584 RETURN
2590 LET X$="1blackbird2vulture3thrush4sparrow5swallow6wren7starling"
2591 LET X$=X$+"8owl9pigeon10buzzard11skylark12penguin13woodpecker14eagle15nightingale16goose17magpie18jay19cockatoo20robin21hummingbird22linnet23turkey24parrot25budgerigar"
2592 LET R=25
2593 LET N$="bird"
2594 RETURN
3000 IF Q<=15 THEN PRINT PAPER 2;AT 16,14-Q+2*A;B$
3005 IF Q>15 THEN PRINT PAPER 2;AT 16,15-Q/2+A;B$
3006 BEEP .1,12: IF Q<=15 THEN PRINT AT 16,14-Q+2*A; PAPER 7;B$
3007 IF Q>15 THEN PRINT AT 16,15-Q/2+A; PAPER 7;B$
3010 LET C=1
3020 LET C$(A)=A$(A)
3030 RETURN
3050 CLS : PRINT AT 5,0;" ";z$;AT 10,0;"You have already put in a word-list."'''"If you really want to enter a new list, you will have to BREAK, and re-RUN the program.";AT 21,0;"Press any key to continue."
3054 IF INKEY$<>"" THEN GO TO 3054
3056 IF INKEY$="" THEN GO TO 3056
3060 GO TO 50
4000 RANDOMIZE 0: LET c=INT (RND*8): IF c=3 OR c=2 THEN GO TO 4000
4001 BORDER c: PAPER c: CLS : INK 9: CIRCLE 128,115,56
4002 ON ERR GO TO 9990
4003 LET p=72: FOR i=115 TO 170
4005 IF POINT (p,i) THEN PLOT p,i: DRAW 2*(128-p),0: BEEP .01,p-72: PLOT p,230-i: DRAW 2*(128-p),0: BEEP .01,p-72: GO TO 4007
4006 LET p=p+1: GO TO 4005
4007 NEXT i
4010 IF c>3 THEN BRIGHT 1
4011 FOR j=4 TO 8: PRINT AT j,11;" \::\::\::\::\ \::\ \::\ ": NEXT j
4013 PRINT AT 4,12;"\..\..\..\::\ \..\ \..";AT 6,12;"\..\..": PAPER c: INK 9: BRIGHT 0
4014 PRINT AT 10,15;"-": FOR J=0 TO 7
4016 PRINT AT 10,j;" FISHER";AT 10,24-j;"MARRIOTT"; PAPER c;" ": BEEP .1,42-6*j: BEEP .1,39-6*j: NEXT j
4018 PRINT AT 10,8;" FISHER-MARRIOTT"; PAPER c;" "
4025 PRINT AT 15,3;"\: \: \. \: \ .\: ";TAB 3;"\: \: \: \: \: \: ";TAB 3;"\: \: \: \r\s\t\q\' \r\s\: \q\s\t\: \r\s\: \: \: \: ";TAB 3;"\: \: \: \: \: \: \: \: \: \: \: \: \: \: \: \: ";TAB 3;"\o\p\o\p\c\o\p\c\: \o\p\: \u\p\c\o \o\p\: \o\p\: \: ";
4026 PRINT TAB 16;"\: \: ";TAB 16;"\: \o\p\c"
4027 PRINT AT 21,3;"\* 1983"
4030 BEEP 1,-24
4038 FOR D=1 TO 200
4040 NEXT D
4042 GO TO 5
5000 CLS : PRINT TAB 10;"\::\::\::";Z$;"\::\::\::"
5002 LET Z=99
5004 GO SUB 1700
5008 IF INKEY$<>"" THEN GO TO 5008
5009 PRINT AT 20,4;"Press any key to start"
5010 LET E=1
5012 IF INKEY$<>"" THEN GO TO 5016
5013 LET E=1-E: LET p=7+e
5014 GO TO 5088
5015 GO TO 5013
5016 LET Z=0
5020 LET B=0
5021 LET F1=0
5022 LET l=8
5024 LET C$=""
5025 LET H$="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
5026 CLS
5028 PRINT AT 10,0;"\::\::\:: Word-search in progress \::\::\::"
5030 IF W$="J" THEN GO SUB 2510+10*INT (RND*N)
5031 GO SUB 2030
5032 CLS
5033 PRINT TAB 5;"\::\:: Try to guess this \::\::";AT 1,16-LEN N$/2;"";N$
5034 PRINT AT 16,16-Q;
5035 IF Q>15 THEN PRINT AT 16,16-Q/2;
5036 FOR A=1 TO Q: BEEP .1,0:
5038 PRINT (" " AND A$(A)=" ")+("*"+CHR$ 17+CHR$ 8 AND A$(A)<>" ")+(" " AND Q<=15);
5039 PRINT (CHR$ 8 AND A$(A)=" ")+(CHR$ 8 AND A$(A)<>" ")+(CHR$ 8 AND Q<=15);
5040 LET C$=C$+" "
5041 PRINT (" " AND A$(A)=" ")+("*" AND A$(A)<>" ")+(" " AND Q<=15);
5042 NEXT A
5044 PRINT AT 19,0;"Guess a letter:"
5046 LET F=0
5048 LET B=B+1
5050 LET C=0
5052 IF B>16 THEN LET F=31
5054 IF INKEY$<>"" THEN GO TO 5054
5056 PRINT AT 21,2*B-2-F;"#"
5058 LET B$=INKEY$
5060 IF B$>"@" AND B$<"[" THEN GO TO 5065
5061 IF B$>"`" AND B$<"{" THEN GO TO 5065
5064 GO TO 5058
5065 BEEP .1,15: PRINT AT 19,0;" "
5070 GO SUB 5220
5071 IF F1=1 THEN LET b=b-1: GO TO 5078
5072 PRINT AT 21,2*B-2-F;"";B$
5073 LET b$=CHR$ (CODE b$+(32*(a$(1)>"`"))-(32*(b$>"`"))): FOR A=1 TO Q
5074 IF B$=A$(A) THEN GO SUB 3000
5076 NEXT A
5078 IF C=0 THEN LET L=L-1: BEEP .1,0: BEEP .5,-6
5080 GO SUB 1200+L*100
5082 IF C$=A$ THEN GO TO 5200
5084 IF L<>0 THEN GO TO 5044
5086 LET E=0: LET p=8
5088 PRINT AT 5,17;" \b ": BEEP .01,20
5092 IF E THEN PRINT AT 6,17;" \b "
5093 PRINT AT p-1,17;" \a";CHR$ 17;CHR$ 8;" ": BEEP .01,18
5094 PRINT AT p,17;"\r:\d": BEEP .01,16
5096 PRINT AT p+1,17;"\e:\f": BEEP .01,12
5098 PRINT AT p+2,17;" \g ": BEEP .01,8
5100 PRINT AT p+3,17;" \h ": BEEP .01,2
5102 PRINT AT p+4,17;" \h ": BEEP .01,-4
5104 PRINT AT p+5,17;"\i\j\k": BEEP .1,-10
5106 PRINT AT p+6,17;" "
5108 IF Z THEN GO TO 5012
5110 GO SUB 500
5112 LET E=1-E
5114 IF INKEY$="" THEN LET p=7+e: GO TO 5088
5116 CLS
5117 PRINT PAPER 7;AT 10,0;"Your life has been returned."
5118 GO TO 5203
5200 FOR i=0 TO 12: BEEP .05,i*3: NEXT i: BEEP .5,36
5202 CLS : PRINT PAPER 7;AT 10,0;"Saved from a certain death";AT 14,0;"Well done"
5203 PRINT AT 17,0;"Press:"; PAPER 8;" "; PAPER 7;"Y For the same again",AT 18,7;"N For a new set of words";AT 19,7;"C To change the game",
5204 IF INKEY$<>"" THEN GO TO 5204
5205 LET D$=INKEY$
5206 IF D$="Y" OR d$="y" THEN GO TO 5016+2004*(G$="2")
5207 IF D$="N" OR d$="n" THEN GO TO 100
5208 IF D$<>"C" AND d$<>"c" THEN GO TO 5205
5212 LET G$=("1" AND G$="2")+("2" AND G$="1")
5213 LET Z$=("Hangman" AND G$="1")+("Anagrams" AND G$="2")
5214 LET CG=1
5215 LET r3=INT (RND*8): IF r3=2 OR r3=3 THEN GO TO 5215
5216 PAPER r3: BORDER r3: INK 9: CLS
5217 GO TO 5000+2000*(G$="2")
5220 LET H=CODE B$-64-32*(b$>"`")
5221 LET F1=0
5222 IF H$(H)<>" " THEN GO TO 5230
5224 PRINT AT 18,2;"\::\:: You have already had ";B$;" \::\::"
5226 FOR D=1 TO 150
5227 NEXT D
5228 PRINT AT 18,2;" "
5229 LET F1=1
5230 LET H$(H)=" "
5232 RETURN
7000 CLS
7012 PRINT " ";Z$;AT 6,0;" In this game";TAB 21;AT 7,0;" the computer";TAB 21;AT 8,0;" finds a word,";TAB 21;AT 9,0;" and jumbles it up."
7014 PRINT AT 14,0;" You have to";TAB 21;AT 15,0;" guess the word.";TAB 21
7015 PRINT AT 21,0; PAPER 7;"Press any key"
7016 IF INKEY$<>"" THEN GO TO 7016
7018 IF INKEY$="" THEN GO TO 7018
7019 IF NOT CG THEN GO TO 100
7020 CLS
7022 PRINT AT 10,0;" Word-search in progress "
7024 IF W$="J" THEN GO SUB 2510+10*INT (RND*N)
7025 GO SUB 2030
7026 PRINT AT 12,0;" Word found. Jumbling. "
7028 LET P=14-Q/2
7029 LET Y$=A$
7031 PRINT AT 14,0;
7032 FOR A=1 TO Q
7036 LET Z=INT (Q*RND+1)
7037 IF Y$(Z)=" " THEN GO TO 7036
7038 LET Z1=INT (Q*RND+1)
7039 IF Y$(Z1)=" " THEN GO TO 7038
7040 LET S$=Y$(Z)
7041 LET Y$(Z)=Y$(Z1)
7042 LET Y$(Z1)=S$
7043 BEEP .01,RND*20: PRINT PAPER RND*7;AT 14,INT (RND*16)+9;CHR$ (RND*130+32);Y$(Z)
7044 BEEP .01,-RND*20: PRINT PAPER RND*7;AT 14,INT (RND*16)+9;CHR$ (RND*130+32);Y$(Z1)
7045 BEEP .01,RND*20: PRINT PAPER RND*7;AT 14,INT (RND*6)+9;CHR$ (RND*130+32)
7046 NEXT A
7047 IF Y$=A$ THEN GO TO 7032
7048 CLS
7050 PRINT AT 0,8;" ";Z$;" ";AT 3,0;" Here is your jumbled word ";AT 9,P;" "; PAPER 8;P$( TO 4+Q)+" ";AT 10,P;" ";TAB Q+P+2;" ";AT 11,P;" ";TAB Q+P+2;" ";AT 12,P;" ";TAB Q+P+2;" ";AT 13,P;" "; PAPER 8;P$( TO 4+Q)+" "
7051 PRINT AT 6,0;(" It is a " AND N$<>"\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::")+("\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::" AND N$="\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::");N$;TAB 30;" "
7052 PRINT PAPER 0; BRIGHT 1;AT 11,P+2;Y$
7053 PRINT AT 15,P+2;
7054 FOR J=1 TO Q
7055 PRINT ("*" AND Y$(J)<>" ")+(" " AND Y$(J)=" ");
7056 NEXT J
7058 PRINT AT 19,0;"\::\:: Guess the ";
7059 LET NG=0
7060 FOR J=1 TO Q
7062 IF A$(J)=" " THEN GO TO 7084
7064 PRINT PAPER 7;AT 19,13;J;("st" AND J=1)+("nd" AND J=2)+("rd" AND J=3)+("th" AND J>=4)+" letter."
7066 PRINT PAPER 7;AT 21,0;"\::\:: Wrong guesses>> ";NG
7072 PRINT PAPER 7;AT 15,J+P+1;"#"
7073 LET i$=INKEY$: IF I$="" THEN GO TO 7073
7074 LET i$=CHR$ (CODE i$+(32*(a$(1)>"`"))-(32*(i$>"`")))
7077 BEEP .01,0: PRINT PAPER 2;AT 15,J+P+1;I$: BEEP .1,0
7078 IF I$<>A$(J) THEN LET NG=NG+1
7080 IF INKEY$>"" THEN GO TO 7080
7082 IF I$<>A$(J) THEN BEEP .1,12: BEEP .5,6: GO TO 7066
7084 FOR i=0 TO 5: BEEP .01,i*3: NEXT i: BEEP .1,20: PRINT PAPER 7; BRIGHT 1;AT 15,J+P+1;A$(J)
7085 FOR i=1 TO q: IF y$(i)=i$ THEN PRINT AT 11,p+1+i;" ";: LET y$(i)="*": LET i=q
7086 NEXT i: NEXT J
7088 PRINT AT 19,0;" ";TAB 0;
7090 IF NG>0 THEN PRINT " Well done! Solved in ";ng;" attempt";"s" AND ng>1;" " AND ng=1;" ";" " AND ng<10;" "
7092 IF NG=0 THEN PRINT " Congratulations!! Solved at the first attempt "
7094 NEXT J
7096 FOR j=1 TO 150: NEXT j: CLS
7098 PRINT AT 8,0;" ";Z$
7100 GO TO 5203
9899 PAUSE 250: RUN
9900 CLEAR : SAVE "wordplay1" LINE 9902: SAVE " "CODE USR "a",168: STOP
9902 LOAD ""CODE : RUN 4000
9990 ON ERR RESET
9991 PAUSE 100
9992 ON ERR GO TO 9990
9993 ON ERR CONTINUE
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.


