This adaptation of a perennial game format features the fastest movement programmable in BASIC on the Sinclair. Characters are POKEd directly into the portion of the memory beginning at 16396 known as the Display File. Scoring occurs when positions in the same file are PEEKed to see if they are already occupied.
The listing is annotated using variable names which can be abbreviated to one letter for typing in. Timing Loops are used instead of the PAUSE command. The PRINT staements after line 900 indicate bytes used by this program. As given WORM will run in 2K or 16K on a T/S 1000. For 1K ZX81’s, omit instructions and scoring messages as well as auto-run, You may want to remove one row from the playing field as well.
The INKEY$ routine in line 110 is perhaps the shortest way to implement all four directions in one statement. Other characters may be POKEd into the field, but some of these will trigger lockup or a crash.Line 110 can also be adapted to work with a joystick such as described elsewhere in this issue.
This approach to manipulating the Display File is worth investigating as the first step towards understanding the machine code possibilities of our machines.

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-16384
Transcription note: line 6 RAND is added (it is not in the magazine). Without it, on a computer just switched on, the first asterisk lands under the worm and cannot be seen, so the first game cannot score.
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.