A worm game for the TS1000 or ZX81. A field of ten black rows fills the top of the screen; steer the worm (an inverse W) with the arrow keys 5, 6, 7 and 8 to the inverse asterisk. Each asterisk scores 10 and a new one appears. The worm leaves a trail it cannot cross, so the field slowly closes in. Key Q to quit: the program rates the score (TRY HARDER below 100, GOOD. DO BETTER. up to 149, *EXCELLENT* from 150) and starts a new field.
The program POKEs the worm and the asterisk straight into the display file and PEEKs it to see what is in the way, which the article calls the fastest movement possible in BASIC. It needs 2K or more (it was tested on 2K and 16K, as the article says); the article explains that a 1K ZX81 needs the instructions, scoring messages and auto-run left out, which this file does not do. Lines 900-911 print the bytes used and are not part of the game; line 300 saves the program to run itself from line 1.
Correction: as printed, on a machine just switched on the very first asterisk lands under the worm’s starting square and cannot be seen, so the first game cannot score. A line 6 RAND has been added so that every game starts from a fresh random position.
Published in the BCS Sinclair-Timex User Group Newsletter March 1984 (The Worm Turns).
Source Code
1 PRINT AT 3,8;"[inverse: THE WORM TURNS ]";AT 5,4;"USE ARROWS TO MOVE [inverse W] TO [inverse *]. KEY ""Q"" TO QUIT."
2 FOR L=1 TO 100
3 NEXT L
4 CLS
5 FAST
6 RAND
7 LET SCORE=0
10 FOR L=0 TO 319
15 PRINT "■";
20 NEXT L
30 SLOW
35 PRINT "SCORE=";SCORE
40 LET WORM=1+PEEK 16396+256*PEEK 16397
50 LET PLACE=WORM
60 LET ASTERIX=PLACE+RND*329
70 IF PEEK ASTERIX<>128 THEN GOTO 60
80 POKE ASTERIX,151
90 POKE WORM,188
91 REM POKE 142 = HARDER
100 LET MOVE=WORM
110 LET WORM=WORM+(INKEY$="8")+33*(INKEY$="6")-(INKEY$="5")-33*(INKEY$="7")
120 IF INKEY$="Q" THEN GOTO 250
130 IF PEEK WORM=151 THEN GOTO 200
140 IF PEEK WORM<>128 THEN LET WORM=MOVE
150 GOTO 80
200 POKE WORM,188
201 REM POKE 142 = HARDER
210 LET SCORE=SCORE+10
215 PRINT AT 10,6;SCORE
230 GOTO 60
250 IF SCORE<100 THEN PRINT AT 10,10;"TRY HARDER"
255 IF SCORE>=100 AND SCORE<150 THEN PRINT AT 10,10;"GOOD. DO BETTER."
260 IF SCORE>=150 THEN PRINT AT 10,10;"*EXCELLENT*"
280 FOR L=1 TO 100
285 NEXT L
290 GOTO 4
300 SAVE "WOR[inverse M]"
301 GOTO 1
900 REM PROGRAM AND SYS.VARS.
901 PRINT PEEK 16396+256*PEEK 16397-16384
910 REM PROG.,SYS.VARS,PROG.VARS AND DISPLA
911 PRINT PEEK 16404+256*PEEK 16405-16384Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.



