Word Search

Type
Education
Category
Word-search puzzle game
Author
Skeet Nevil, Mark Barr and Jim Buschmeier
Published in
Public domain; Page 6 PD library and the BELLCOM public domain disks
Language
Atari BASIC
Requirements
Any 8-bit Atari with 16K+ and Atari BASIC; joystick in port 1
A grid of capital letters in which the words WORD, SEARCH, BY, SKEET and NEVIL are picked out in green, with INSTRUCTIONS (Y-N) underneath

About the program

Word Search is a public domain game that turns the classic puzzle-book page into something the computer generates fresh every time. Even the title screen is a puzzle: a 12×12 block of letters with WORD, SEARCH, BY, SKEET and NEVIL picked out in a second colour. Each round, the program chooses words at random, hides them forwards, backwards, up, down or diagonally, and fills the rest of the grid with random letters. You hunt for them with a joystick cursor. The program was spread through the Page 6 PD library and the BELLCOM public domain disks.

What you need

Any Atari with Atari BASIC and 16K or more, and a joystick in port 1.

Typing it in

  • The listing is plain ASCII except for a few inverse-video words ({inv}CLUE:{/inv}, the direction names in lines 311–318, MISS NUMBER, PLAY AGAIN (Y/N), and SPACE BAR, C, G in the instructions). Type the text between {inv} and {/inv} after pressing the Atari (inverse) key, then press it again to switch back.
  • The lower-case letters in the title DATA (lines 400–401) are important. In GRAPHICS 1, lower case shows in a different colour, and that's what makes the hidden title words stand out.
  • Each word in lines 410–424 ends with *. The program uses it as an end marker, so don't leave it off.

How to play

Answer Y or N to the instructions, then press 1–4 for the level:

Level Puzzle
1 Five everyday words (TREE, HOUSE, BIRTHDAY…) in a 10×10 grid
2 Ten computer words (BYTE, FLOWCHART, HEXADECIMAL…) in a 20×20 grid
3 / 4 As 1 / 2, but the letters disappear after a moment

The word to find is shown at the bottom left. Steer the inverse-video cursor onto its first letter and press the trigger. SPACE moves on to the next word on the list, C gives a clue (the word's direction, such as "SW TO NE") and G gives up and highlights it. A word is worth 20 points in the first minute, 2 fewer for each minute after that (never less than 2), half that after a clue, and nothing if you give up. A third miss ends the game.

How it works

Placing the words is a small exercise in vectors. Lines 21–28 turn a direction number 1–8 into a step (X1, Y1). The routine at line 40 walks the word along that path in the array T(19,19) and gives up if it runs off the grid or crosses a different letter. Crossings with the same letter are allowed, as in a real puzzle. If a placement fails, line 980 picks a new word and position. Found words are marked by adding 128 or 96 to their character codes, which in GRAPHICS 1 switches them to another colour. The minute-by-minute scoring reads the jiffy clock in locations 19 and 20 (3,600 jiffies is one minute on an NTSC machine). Keys are read straight from location 764, so no keyboard handler needs to be opened.

Variations to try

  • Put your own word lists in lines 410–414 or 420–424. Keep ten words per line, end each with *, and keep them short enough to fit the grid (at most 10 letters for the easy levels).

Listing

10 GOTO 500
20 GOTO 20+D
21 X1=1:Y1=0:GOTO 30
22 X1=1:Y1=1:GOTO 30
23 X1=0:Y1=1:GOTO 30
24 X1=-1:Y1=1:GOTO 30
25 X1=-1:Y1=0:GOTO 30
26 X1=-1:Y1=-1:GOTO 30
27 X1=0:Y1=-1:GOTO 30
28 X1=1:Y1=-1:GOTO 30
30 RETURN
40 X2=X:Y2=Y:E=0
50 FOR J=1 TO LEN(T$)
60 IF X2<MN OR X2>MX OR Y2<MN OR Y2>MX THEN E=1:POP:GOTO 120
70 IF T(X2,Y2)=0 THEN 80
75 IF ASC(T$(J,J))<>T(X2,Y2) THEN E=1:POP:GOTO 120
80 X2=X2+X1:Y2=Y2+Y1:NEXT J
100 FOR J=1 TO LEN(T$):T(X,Y)=ASC(T$(J,J))
110 X=X+X1:Y=Y+Y1:NEXT J
120 RETURN
130 FOR Y=MN TO MX:P=100:FOR X=MN TO MX:SOUND 0,P,10,10:P=P-4
140 POSITION X,Y:IF T(X,Y)<>0 THEN ? #6;CHR$(T(X,Y)):GOTO 160
150 ? #6;CHR$(INT(RND(0)*26)+65)
160 NEXT X:NEXT Y
170 SOUND 0,0,0,0:RETURN
180 POSITION 11,22:T$=STR$(R):GOTO 210
190 POSITION 7,23:T$=STR$(V):GOTO 210
200 POSITION 17,23:T$=STR$(S):GOTO 210
210 FOR I=1 TO LEN(T$):? #6;CHR$(ASC(T$(I,I))+96);:NEXT I:IF I=2 THEN ? #6;" "
220 RETURN
230 X2=X(W):Y2=Y(W):D=D(W):GOSUB 20
240 FOR I=1 TO L(W)
242 IF T(X2,Y2)>192 THEN 255
243 IF T(X2,Y2)>96 AND A=128 THEN A1=96:GOTO 248
246 IF T(X2,Y2)>96 AND A=32 THEN 255
247 A1=A
248 T(X2,Y2)=T(X2,Y2)+A1
249 IF X=X2 AND Y=Y2 THEN C=C+A1:GOTO 255
250 POSITION X2,Y2:? #6;CHR$(T(X2,Y2))
255 X2=X2+X1:Y2=Y2+Y1
260 NEXT I
270 P=12*W-11:W$(P,P)="*"
280 R=R-1:GOSUB 180
290 RETURN
300 POSITION 3,20:? #6;"{inv}CLUE:{/inv}";
310 ON D(W) GOTO 311,312,313,314,315,316,317,318
311 T$="{inv}W TO E{/inv}":GOTO 320
312 T$="{inv}NW TO SE{/inv}":GOTO 320
313 T$="{inv}N TO S{/inv}":GOTO 320
314 T$="{inv}NE TO SW{/inv}":GOTO 320
315 T$="{inv}E TO W{/inv}":GOTO 320
316 T$="{inv}SE TO NW{/inv}":GOTO 320
317 T$="{inv}S TO N{/inv}":GOTO 320
318 T$="{inv}SW TO NE{/inv}":GOTO 320
320 ? #6;T$
330 C(W)=1:V=V/2:GOSUB 190
340 FOR I=1 TO 6:FOR P=121 TO 96 STEP -1:SOUND 0,P,10,10:NEXT P
345 FOR P=96 TO 121:SOUND 0,P,10,10:NEXT P:NEXT I:SOUND 0,0,0,0
350 POSITION 3,20:? #6;" "
360 RETURN
370 RESTORE 430:FOR I=1 TO 6:READ P,D:FOR J=1 TO D:SOUND 0,P,10,10:NEXT J:NEXT I:SOUND 0,0,0,0:RETURN
380 LO=57:HI=45:NT=HI:FOR T=0 TO 6:SOUND 0,NT,10,14
381 FOR I=1 TO 120:NEXT I
382 NT=LO:LO=HI:HI=NT:NEXT T
383 SOUND 0,0,0,0:RETURN
390 FOR I=1 TO 30:SOUND 0,29,10,10:NEXT I:SOUND 0,0,0,0:RETURN
395 FOR P=60 TO 121:SOUND 0,P,10,10:NEXT P:SOUND 0,0,0,0:RETURN
400 DATA JXHHVAPLMMOK,CwordKIOBPCR,FLTYPDsWTRZM,NYNNXPOeKNWI,GIRULPADaHLS,NWIUYSCZQrPU
401 DATA BHXSRCHRHFcL,BDybZMYXJHTh,MZKMDFGRWTLP,DHDUskeetBXE,PMOHVOnevilA,NIWOPAJNUCDD
410 DATA TREE*,HOUSE*,BOAT*,BOY*,GIRL*,BIG*,STORE*,PRETTY*,HELP*,FOOD*
411 DATA BROWN*,HIDE*,WATER*,CAT*,APPLE*,GRASS*,SKY*,BOOK*,DISH*,FAST*
412 DATA PLAY*,CUP*,EAT*,RADIO*,NORA*,STONE*,BIKE*,TOY*,SWING*,RIVER*
413 DATA BALL*,FORK*,SPOON*,SAID*,FLOWER*,BOB*,LEAVE*,SORRY*,PLEASE*,THANK*
414 DATA BIRTHDAY*,HOME*,CAR*,WAGON*,MILK*,COOKIE*,DESERT*,SAND*,MAYBE*,YES*
420 DATA ATARI*,COMPUTER*,BYTE*,DEBUG*,FLOWCHART*,BASIC*,PROGRAM*,SUBROUTINE*,ADDRESS*,MEMORY*
421 DATA BINARY*,HEXADECIMAL*,LOGIC*,COBOL*,FORTRAN*,DATA*,ASSEMBLER*,COMPILE*,ERROR*,JUMP*
422 DATA GOTO*,CURSOR*,DISPLAY*,DISK*,TAPE*,ARITHMETIC*,FILE*,FUNCTION*,LIBRARY*,PEEK*
423 DATA POKE*,GOSUB*,RETURN*,GRAPHICS*,INPUT*,OUTPUT*,KEYBOARD*,LOOP*,MATRIX*,STRING*
424 DATA VARIABLE*,RANDOM*,PIXEL*,COORDINATE*,STACK*,PRINTER*,RESTORE*,MODE*,POSITION*,EXECUTE*
430 DATA 121,15,96,15,81,15,60,40,81,15,60,40
500 DIM W$(120),T$(12),T(19,19),X(10),Y(10),D(10),L(10),C(10)
510 GRAPHICS 17:SETCOLOR 0,0,4:SETCOLOR 1,0,4:SETCOLOR 4,0,4
520 FOR I=4 TO 15:READ T$:POSITION 4,I:? #6;T$:NEXT I
530 GOSUB 390:SETCOLOR 0,0,0:SETCOLOR 1,0,0:FOR I=1 TO 500:NEXT I:GOSUB 390:SETCOLOR 1,12,10
540 POSITION 1,22:? #6;"instructions ";CHR$(8);"y";CHR$(13);"n";CHR$(9)
550 POKE 764,255
560 IF PEEK(764)=255 THEN 560
570 KEY=PEEK(764):IF KEY=35 THEN GOSUB 390:GOTO 710
580 IF KEY<>43 THEN 550
585 GOSUB 390
590 GRAPHICS 0:? " Words will be randomly placed on":? "the screen. They may be spelled fore-"
600 ? "ward, backwards, up,down, or on a":? "diagonal.":?:? " Use the joystick to find the"
610 ? "first letter of a word and press the":? "trigger. You will be allowed only two"
620 ? "misses. The game will end on the":? "third miss.":?
630 ? " Use the {inv}SPACE BAR{/inv} to list the":? "hidden words. Press '{inv}C{/inv}'for a clue"
640 ? "or '{inv}G{/inv}' to give up on a word.":?:? " Words are worth 20 points for the"
650 ? "first minute and decrease in value by":? "2 points for each additional minute."
660 ? "After 9 minutes, words will remain at":? "2 points each. A clue will cut the"
670 ? "point value in half for that word. A":? "word that was given up is worth zero."
680 ?:? " Press any key to continue.";
690 POKE 764,255
700 IF PEEK(764)=255 THEN 700
705 GOSUB 390
710 GRAPHICS 17:SETCOLOR 0,12,10:SETCOLOR 4,0,4
720 POSITION 0,2:? #6;"1: FIVE EASY WORDS":POSITION 3,3:? #6;"100 LETTERS"
725 POSITION 0,5:? #6;"2: TEN COMPUTER":POSITION 3,6:? #6;"RELATED WORDS"
730 POSITION 3,7:? #6;"400 LETTERS":POSITION 0,9:? #6;"3: SAME AS 1 EXCEPT"
735 POSITION 3,10:? #6;"INVISIBLE LETTERS":POSITION 0,12:? #6;"4: SAME AS 2 EXCEPT"
740 POSITION 3,13:? #6;"INVISIBLE LETTERS":POSITION 5,16:? #6;"LEVEL (1-4)"
750 POKE 764,255
760 KEY=PEEK(764):IF KEY=31 OR KEY=26 THEN MX=14:MN=5:NW=5:GOTO 790
770 IF KEY=30 OR KEY=24 THEN MX=19:MN=0:NW=10:GOTO 790
780 GOTO 760
790 GOSUB 390:IF KEY=31 OR KEY=30 THEN INVSBL=0:GOTO 830
800 INVSBL=1:GOTO 830
830 GRAPHICS 17:SETCOLOR 4,0,4:SETCOLOR 1,2,8:SETCOLOR 0,12,10:SETCOLOR 2,12,10
835 POSITION 0,7:? #6;"ONE MOMENT PLEASE..."
840 FOR I=MN TO MX:FOR J=MN TO MX:T(I,J)=0:NEXT J:NEXT I
850 FOR I=1 TO NW
860 R1=INT(RND(0)*5)+1:R2=INT(RND(0)*10)+1
865 IF NW=5 THEN RESTORE R1+409:GOTO 880
870 RESTORE R1+419
880 FOR J=1 TO R2:READ T$:NEXT J
890 W$(12*I-11)=T$
900 IF I=1 THEN 930
910 FOR J=1 TO I-1:IF W$(12*J-11,12*J+LEN(T$)-12)=T$ THEN POP:GOTO 860
920 NEXT J
930 T$=" ":J=1
940 P=12*I-12+J:IF W$(P,P)="*" THEN 960
950 T$(J,J)=W$(P,P):J=J+1:GOTO 940
960 X=INT(RND(0)*(MX-MN+1))+MN:Y=INT(RND(0)*(MX-MN+1))+MN
970 D=INT(RND(0)*8)+1:X(I)=X:Y(I)=Y:D(I)=D:L(I)=LEN(T$):GOSUB 20:GOSUB 40
980 IF E=1 THEN 860
990 C(I)=0:NEXT I
1000 GOSUB 390:POSITION 4,9:? #6;" THANK YOU."
1010 FOR I=1 TO 400:NEXT I
1020 POSITION 0,7:? #6;" "
1030 SETCOLOR 0,0,0
1040 GOSUB 130
1050 IF INVSBL=1 THEN FOR I=1 TO 400:NEXT I:GOSUB 390:SETCOLOR 0,0,4
1140 POSITION 0,21:? #6;"word";CHR$(26)
1150 POSITION 0,22:? #6;"remaining";CHR$(26)
1160 POSITION 0,23:? #6;"value";CHR$(26):POSITION 10,23:? #6;"score";CHR$(26)
1170 R=NW:V=20:S=0:W=S:M=S:X=9:Y=X:POKE 18,S:POKE 19,S:POKE 20,S
1180 LOCATE X,Y,C:POSITION X,Y:? #6;CHR$(C+160)
1190 GOSUB 180:GOSUB 190:GOSUB 200
1200 IF R=0 THEN GOTO 1590
1205 IF W=0 THEN 1210
1206 IF C(W)=1 THEN V=V*2:GOSUB 190
1210 W=W+1:IF W>NW THEN W=1
1220 P=12*W-11:IF W$(P,P)="*" THEN 1210
1230 POSITION 6,21:? #6;" ":POSITION 6,21
1240 IF W$(P,P)="*" THEN 1255
1250 ? #6;CHR$(ASC(W$(P,P))+160);:P=P+1:GOTO 1240
1255 IF C(W)=1 THEN GOSUB 300
1260 POKE 764,255
1270 IF (C(W)=1 AND V=1) OR (C(W)=0 AND V=2) THEN 1310
1280 IF 256*PEEK(19)+PEEK(20)<3600 THEN 1310
1290 GOSUB 390:POKE 19,0:POKE 20,0
1300 IF C(W)=1 THEN V=V-1:GOTO 1305
1302 V=V-2
1305 GOSUB 190
1310 KEY=PEEK(764)
1320 IF KEY=33 THEN FOR I=1 TO 30:SOUND 0,121,12,10:NEXT I:SOUND 0,0,0,0:GOTO 1200
1330 IF KEY=61 THEN A=32:GOSUB 395:GOSUB 230:GOTO 1200
1335 IF KEY=18 THEN POKE 764,255:IF C(W)<>1 THEN GOSUB 300
1340 IF STRIG(0)<>0 THEN 1460
1350 IF X(W)=X AND Y(W)=Y THEN 1440
1370 M=M+1:POSITION 3,20:? #6;"{inv}MISS NUMBER {/inv}";CHR$(ASC(STR$(M))+128)
1380 GOSUB 380:POSITION 3,20:? #6;" "
1390 IF M>2 THEN A=32:GOTO 1590
1400 POSITION 3,20:? #6;" "
1410 IF STRIG(0)=0 THEN 1410
1420 GOTO 1270
1440 GOSUB 370:A=128:GOSUB 230:S=S+V:GOSUB 200
1450 GOTO 1200
1460 ST=STICK(0):IF ST=15 THEN 1270
1470 IF ST<8 THEN X1=1:Y1=ST-7:GOTO 1500
1480 IF ST<12 THEN X1=-1:Y1=ST-11:GOTO 1500
1490 X1=0:Y1=ST-15
1500 IF Y1=-2 THEN Y1=1
1510 IF X+X1<MN OR X+X1>MX OR Y+Y1<MN OR Y+Y1>MX THEN 1270
1520 POSITION X,Y:? #6;CHR$(C)
1530 X=X+X1:Y=Y+Y1:LOCATE X,Y,C
1540 IF C<91 THEN D=C+160:GOTO 1570
1550 IF C<123 THEN D=C+128:GOTO 1570
1560 D=C+32:GOTO 1570
1570 POSITION X,Y:? #6;CHR$(D)
1580 GOTO 1270
1590 FOR W=1 TO NW
1600 P=12*W-11:IF W$(P,P)="*" THEN 1620
1610 GOSUB 395:GOSUB 230
1620 NEXT W
1625 POSITION 2,20:? #6;"{inv}PLAY AGAIN (Y/N){/inv}":POKE 764,255
1630 POSITION X,Y:? #6;CHR$(C):C=0
1640 IF C=2 THEN C=2:L=0:GOTO 1655
1650 C=2:L=8
1655 GOSUB 390:SETCOLOR 0,C,L
1660 FOR I=1 TO 200
1665 KEY=PEEK(764):IF KEY=43 THEN POP:GOSUB 390:GOTO 710
1670 IF KEY<>35 THEN NEXT I:GOTO 1640
1680 POP:GOSUB 390
1690 GRAPHICS 17:SETCOLOR 4,0,4:SETCOLOR 0,12,10
1700 POSITION 0,10:? #6;"THANKS FOR THE GAME."
1710 FOR I=1 TO 400:NEXT I:POKE 764,255:GOSUB 390

Credits