Runs an Easter egg hunt around the house. The screen sends the child to a real place, such as under the kitchen sink, in the refrigerator or under their pillow, to find a coloured egg. Typing the egg’s colour and pressing ENTER brings up the next hiding place. After eight eggs, the last clue leads to a surprise in the parents’ room. Parents set up their own hunt by editing the places and colours in the LET lines 40–190, and the entry END marks the final clue. Colours must be typed in capitals.
Egg Hunt is by Joey Latimer and was published as a type-in in Family Computing, April 1984. This copy was typed in from the ZX81 version of the listing.
Program Analysis
Structure
Lines 10–20 dimension p$(8,30) for places and c$(8,10) for colours, and lines 40–190 fill them. The loop at 240–530 prints each clue, takes the colour with INPUT, prints “COLOR ACCEPTED” fifteen times on a match, and waits for ENTER. When c$(r) begins with END, line 540 congratulates the player and prints that entry’s place.
Fixes for the 2068
The listing as found on the disk did not run correctly on a 2068, and the download has these fixes:
- Lines 200, 380, 420 and 520 used
CLEARto clear the screen, which also wipes the clue arrays. They now useCLS. - Line 510 waited for
CHR$ 118, the ZX81 NEWLINE code, which the 2068 keyboard never returns. It now waits forCHR$ 13(ENTER). - Line 190 set the end marker to lower-case
end, while line 250 tests forEND. It is now upper case.
Notable Techniques
- Line 370 compares the answer with
c$(r, TO LEN a$), which avoids the trailing spaces of the fixed-length array. - Line 250 slices
c$(r, TO 3)to find the end marker without padding.
Potential Issues
- Because line 370 compares only the first
LEN a$characters, any prefix is accepted. Pressing ENTER on an empty line matches every colour, and one letter such asBis accepted for BLUE. - An answer longer than ten characters is out of range for
c$(r, TO LEN a$)and appears to stop the program with a subscript error. - If no entry is set to
END, the loop ends withrat 9, andp$(r)in line 580 is out of range.
This copy came from a Larken disk and was converted to load from tape. Along with the fixes above, the RANDOMIZE USR 100 prefix and the LOGICALL menu load were removed, and the program now autostarts at line 10. It was tested in ZEsarUX through all eight eggs to “GREAT. YOU HAVE DONE IT.”
Source Code
10 DIM p$(8,30)
20 DIM c$(8,10)
30 REM
40 LET p$(1)= "UNDER THE KITCHEN SINK"
50 LET c$(1)="BLUE"
60 LET p$(2)="IN THE REFRIGERATOR"
70 LET c$(2)="GREEN"
80 LET p$(3)="UNDER YOUR PILLOW"
90 LET c$(3)="YELLOW"
100 LET p$(4)="IN YOUR SOCKS DRAWER"
110 LET c$(4)="RED"
120 LET p$(5)="IN THE BATHROOM"
130 LET c$(5)="ORANGE"
140 LET p$(6)="IN YOUR CLOSET"
150 LET c$(6)="WHITE"
160 LET p$(7)="IN THE MAILBOX"
170 LET c$(7)="PURPLE"
180 LET p$(8)="IN YOUR PARENTS ROOM"
190 LET c$(8)="end"
200 CLEAR
210 PRINT "WELCOME TO THE EASTER"
220 PRINT " EGG HUNT."
230 PRINT
240 FOR r=1 TO 8
250 IF c$(r, TO 3)="END" THEN GO TO 540
260 PRINT "LOOK..."
270 PRINT p$(r)
280 PRINT "FOR A COLORED"
290 PRINT "EASTER EGG."
300 PRINT
310 PRINT "TYPE THE COLOR OF"
320 PRINT "THE EGG, THEN"
330 PRINT "PRESS <ENTER>."
340 PRINT
350 PRINT "WHAT IS THE COLOR?";
360 INPUT a$
370 IF a$ =c$(r, TO LEN a$) THEN GO TO 420
380 CLEAR
390 PRINT "SORRY, WRONG COLOR."
400 PRINT "PLEASE, TRY AGAIN."
410 GO TO 350
420 CLEAR
430 FOR t=1 TO 15
440 PRINT "COLOR ACCEPTED";
450 NEXT t
460 PRINT
470 PRINT
480 PRINT "PRESS <ENTER>"
490 PRINT "TO CONTINUE."
500 LET r$=INKEY$
510 IF r$<>CHR$ 118 THEN GO TO 500
520 CLEAR
530 NEXT r
540 PRINT "GREAT. YOU HAVE"
550 PRINT "DONE IT."
560 PRINT
570 PRINT "LOOK..."
580 PRINT p$(r)
590 PRINT "TO FIND A SURPRISE."
600 STOP
9992 RANDOMIZE USR 100: SAVE "HUNT.B1"
9998 RANDOMIZE USR 100: LOAD "L.B1"Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.


