Zahrcon

Type
Education
Category
Word-guessing game for young children (Hangman variant)
Author
Linda M. Schreiber
Published in
Antic, August 1982 (Vol. 1, No. 3), Education column; reprinted in The Best of Antic, Volume 1
Year
1982
Language
Atari BASIC
Requirements
16K RAM, Atari BASIC, joystick in port 1
Large GRAPHICS 2 text reading ZAHRCON above a red block-built creature, with a menu offering PLAY and END

About the program

Linda Schreiber's Education column in Antic's third issue (August 1982) started from a complaint about Hangman. It rewards children for failing: the little man gets hanged, often with a special display and noises, and kids love that. Her answer was Zahrcon. Each correct letter adds a part to an animated creature. When the word is solved, the creature winks and blinks and there's a sound reward.

The game is aimed at children as young as five or six, so it uses the big letters of GRAPHICS 2, upper case only. All 15 words in the DATA list contain a hard "k" sound, spelled several ways (C, K, CK, CH, QUE), from COULD and KENNEL to LEPRECHAUN and ANTIQUE.

Typing it in

The creature is drawn with ordinary punctuation (# $ % & ' ( ) * + , - .), which the program redefines. Type those characters exactly as shown. {inv}…{/inv} marks inverse video (press the Atari key before and after). In GRAPHICS 2, inverse characters come out in a different colour, which is how the second creature in lines 750–840 differs from the first. {CLEAR} (lines 210 and 400) is ESC then SHIFT-CLEAR. Inverse lower-case end in line 260 is intentional too.

How to play

Push the joystick up or down to move the arrow to PLAY and press the button. The alphabet appears in three columns on the left, with a row of question marks for the secret word. Move up and down through the letters with the stick (the current letter is highlighted) and press the button to guess it. Letters you've used change colour and can't be picked again.

A right letter fills in the word and adds a part to your creature. A wrong one adds a part to a second, different-coloured creature on the right. Solve the word and your creature is finished and winks at you ("HURRAY!!"). If the other creature is completed first, the word is shown. Press the button to go back to the menu.

How it works

  • Character set in RAM. Lines 60–120 copy the first 512 bytes of the ROM font (from 57344) to 1K below the top of memory. Lines 130–193 overwrite 14 characters, from the quotation mark to the full stop, with creature parts. POKE 756,CHBASE switches to the new set.
  • Winking. The apostrophe is the "both eyes open" character. The quotation mark, slash and asterisk are left eye, right eye and no eyes. Printing one of them over the eye position at random intervals (lines 300–330 and 910–980) makes the creature blink.
  • Colour by character code. In GRAPHICS 2 the top two bits of a character code choose its colour register, so CHR$(S), CHR$(S-32) and CHR$(S+128) show the same letter as highlighted, unused or used.
  • POKE 77,0 resets the attract-mode timer so the colours never start cycling while a child is thinking.

Listing

10 REM ******** ZAHRCON ********
20 REM BY L.M. SCHREIBER FOR ANTIC MAY 1982
40 DIM WORD$(10),YWORD$(10),A(26)
50 GRAPHICS 18:REM GRAPHICS 2 WITH NO TEXT WINDOW
60 TOP=PEEK(106):REM FIND OUT HOW MUCH MEMORY IS AVAILABLE
70 CHBASE=TOP-4:REM PLACE CHARACTER SET 1024 BYTES BELOW TOP OF MEMORY
80 OLDCH=57344:NWCH=CHBASE*256:REM STARTING BYTES OF OLD CHARACTER SET AND NEW CHARACTER SET
90 FOR X=0 TO 511:REM MOVE THE NUMBERS, SYMBOLS AND UPPER CASE LETTERS
100 C=PEEK(OLDCH+X):REM GET A BYTE OF THE CHARACTER SET FROM ROM
110 POKE NWCH+X,C:REM RELOCATE IT IN RAM
120 NEXT X
130 NWCH=NWCH+16:REM DO NOT REPLACE THE SPACE OR THE EXCLAMATION POINT
140 FOR X=NWCH TO NWCH+111:REM BYTES IN THE CHARACTER SET TO BE REPLCED
150 READ C:REM READ THE NEW BYTE FROM THE DATA BASE
160 POKE X,C:REM REPLACE THE OLD BYTE WITH THE NEW ONE
170 NEXT X
180 DATA 255,255,255,255,255,255,63,63
181 DATA 129,66,66,36,36,36,24,24
182 DATA 128,224,120,62,31,31,15,15
183 DATA 15,31,63,127,255,0,0,0
184 DATA 63,63,127,127,255,255,255,255
185 DATA 255,255,255,255,255,255,60,60
186 DATA 252,252,254,254,255,255,255,255
187 DATA 255,255,255,255,127,127,63,63
188 DATA 255,255,255,255,255,255,255,255
189 DATA 255,255,255,255,254,254,252,252
190 DATA 255,126,60,24,24,60,126,255
191 DATA 1,7,30,124,248,248,240,240
192 DATA 240,248,252,254,255,0,0,0
193 DATA 255,255,255,255,255,255,252,252
200 POKE 756,CHBASE:REM CHANGE TO THE NEW CHARACTER SET
210 POKE 77,0:? #6;"{CLEAR}":POSITION 4,3:? #6;"#"
220 POSITION 2,4:? #6;"$&'(-     {inv}PLAY{/inv}"
230 POSITION 2,5:? #6;"%)*+."
240 POSITION 4,6:? #6;","
250 POSITION 3,7:? #6;"&*("
260 POSITION 2,8:? #6;"& , (     {inv}end{/inv}"
270 POSITION 2,9:? #6;", * ,"
280 POSITION 6,1:? #6;"ZAHRCON":P=4:P1=4:C=0:GOSUB 990
290 POSITION 10,P:? #6;" ":POSITION 10,P1:? #6;">":REM ERASE THE LAST ARROW AND POSITION THE NEW ONE
300 C=C+1:IF C<75 THEN S=39:GOTO 330
310 IF C=75 THEN S=42:X=INT(RND(0)*3):IF X=1 THEN S=34
320 IF X=2 THEN S=47
330 POSITION 4,4:? #6;CHR$(S):IF C>100 THEN C=0
340 IF STRIG(0)=0 THEN 390:REM CHOICE HAS BEEN MADE
350 IF STICK(0)=15 THEN 300:REM CHECK FOR MOVEMENT ON JOYSTICK
360 POKE 77,0:IF STICK(0)=14 THEN P=P1:P1=P1-4:IF P1<4 THEN P1=4:REM CHECK FOR TOP OF MENU
370 IF STICK(0)=13 THEN P=P1:P1=P1+4:IF P1>8 THEN P1=8:REM CHECK FOR BOTTOM OF MENU
380 GOSUB 990:GOTO 290
390 POKE 77,0:IF P1=8 THEN FE=FRE(S):END
400 ? #6;"{CLEAR}":FOR X=2 TO 10:POSITION 1,X:? #6;CHR$(63+X):NEXT X:REM PRINT LETTERS ON THE RIGHT
410 FOR X=2 TO 10:POSITION 2,X:? #6;CHR$(72+X):NEXT X
420 FOR X=2 TO 9:POSITION 3,X:? #6;CHR$(81+X):NEXT X
430 X=INT(RND(0)*15):RESTORE 1000+X
440 READ WORD$
450 L=LEN(WORD$):P=10-L/2:REM POSITION TO CENTER THE QUESTION MARKS
460 FOR X=P TO P+L-1:POSITION X,11:? #6;"?":NEXT X:REM QUESTION MARKS FOR THE LETTERS
470 FOR X=1 TO 26:A(X)=0:NEXT X:YWORD$(1)=" ":YWORD$(10)=" ":YWORD$(2)=YWORD$:X=1:P1=2:LT1=0:LT2=0
480 LT=0
490 S=(X-1)*9+95+P1:POSITION X,P1:? #6;CHR$(S):GOSUB 990
500 IF STICK(0)=14 THEN POSITION X,P1:? #6;CHR$(S-32+A(S-96)):P1=P1-1:IF P1=1 THEN P1=10:X=X-1
510 IF X=0 THEN X=3:P1=9
520 IF STICK(0)=13 THEN POSITION X,P1:? #6;CHR$(S-32+A(S-96)):P1=P1+1:IF P1=11 THEN P1=2:X=X+1:IF X=4 THEN X=1
530 IF P1=10 AND X=3 THEN P1=2:X=1
535 IF STICK(0)=13 OR STICK(0)=14 THEN POKE 77,0
540 IF STRIG(0)=0 THEN 560
550 GOTO 490
560 POKE 77,0:IF A(S-96)=128 THEN 480
570 A(S-96)=128:REM KEEP LETTER BLUE  ON SCREEN
580 S=S-32:REM GET TRUE CHARACTER VALUE
590 FOR C=1 TO LEN(WORD$):IF ASC(WORD$(C,C))=S THEN POSITION P+C-1,11:? #6;CHR$(S):YWORD$(C,C)=CHR$(S):LT=1
600 NEXT C
610 IF LT=1 THEN 630
620 GOTO 740
630 SN=50:LT1=LT1+1:GOTO 630+LT1*10
640 POSITION 5,7:? #6;"&":POSITION 5,8:? #6;",":GOTO 880
650 POSITION 7,7:? #6;",":POSITION 7,8:? #6;"*":GOTO 880
660 POSITION 9,7:? #6;"(":POSITION 9,8:? #6;",":GOTO 880
670 POSITION 6,6:? #6;"&*(":GOTO 880
680 POSITION 7,5:? #6;",":GOTO 880
690 POSITION 6,4:? #6;")*+":POSITION 6,3:? #6;"&*(":GOTO 880
700 POSITION 5,3:? #6;"$":POSITION 5,4:? #6;"%":GOTO 880
710 POSITION 9,3:? #6;"-":POSITION 9,4:? #6;".":GOTO 880
720 POSITION 7,3:? #6;"'":GOTO 880
730 POSITION 7,2:? #6;"#":POSITION X,P1:? #6;CHR$(S+128):GOTO 880
740 SN=90:LT2=LT2+1:GOTO 740+LT2*10
750 POSITION 14,7:? #6;"{inv}&{/inv}":POSITION 14,8:? #6;"{inv},{/inv}":GOTO 880
760 POSITION 16,7:? #6;"{inv},{/inv}":POSITION 16,8:? #6;"{inv}*{/inv}":GOTO 880
770 POSITION 18,7:? #6;"{inv}({/inv}":POSITION 18,8:? #6;"{inv},{/inv}":GOTO 880
780 POSITION 15,6:? #6;"{inv}&*({/inv}":GOTO 880
790 POSITION 16,5:? #6;"{inv},{/inv}":GOTO 880
800 POSITION 15,4:? #6;"{inv})*+{/inv}":POSITION 15,3:? #6;"{inv}&*({/inv}":GOTO 880
810 POSITION 14,3:? #6;"{inv}${/inv}":POSITION 14,4:? #6;"{inv}%{/inv}":GOTO 880
820 POSITION 18,3:? #6;"{inv}-{/inv}":POSITION 18,4:? #6;"{inv}.{/inv}":GOTO 880
830 POSITION 16,3:? #6;"{inv}'{/inv}":GOTO 880
840 POSITION 16,2:? #6;"{inv}#{/inv}":POSITION X,P1:? #6;CHR$(S+128)
850 POSITION P,11:? #6;WORD$:SOUND 0,200,10,10:GOSUB 990:SOUND 0,0,0,0
860 IF STRIG(0)=0 THEN GOSUB 990:POSITION 0,0:GOTO 210
870 GOTO 860
880 FOR SS=16 TO 0 STEP -2:SOUND 0,SN,10,SS:NEXT SS
890 IF YWORD$(1,L)<>WORD$ THEN 480
900 IF LT1<10 THEN 630:REM FINISH BODY
910 POSITION 6,1:? #6;"        ":GOSUB 990:POSITION 6,1:? #6;"HURRAY!!":X=INT(RND(1)*3)+1:ON X GOTO 920,930,940
920 S=42:GOTO 950
930 S=47:GOTO 950
940 S=34
950 IF STRIG(0)=0 THEN GOSUB 990:GOTO 210
960 POSITION 7,3:? #6;CHR$(S):REM PRINT AN EYE
970 GOSUB 990
980 POSITION 7,3:? #6;"'":GOSUB 990:GOTO 910
990 FOR TIME=1 TO 50:NEXT TIME:RETURN
1000 DATA COULD
1001 DATA COUPLE
1002 DATA KENNEL
1003 DATA KINDS
1004 DATA CROCODILE
1005 DATA FRECKLES
1006 DATA BACKWARDS
1007 DATA PACKAGE
1008 DATA NICKEL
1009 DATA MECHANIC
1010 DATA LEPRECHAUN
1011 DATA ORCHESTRA
1012 DATA SKUNK
1013 DATA TRAGIC
1014 DATA ANTIQUE

Download

The original program from the Antic disk, to LOAD or ENTER instead of typing it: ZAHRCON.BAS.

Credits