Entrapment

Author(s): Wayne DeJulia
Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v3 n8 (Volume 3, Issue 8)
Date: August 1982
Pages: 10

This game pits you against your 8K computer. The playing field is a rectangle with two different starting points. The computer controls the + character and you control the inverse *. You try to maneuver the computer’s string of plusses into a box the leading plus cannot get out of. The computer will not hit the boundary, itself, or your string of asterisks as long as the lead plus can move in a direction that is not occupied. You win when the computer is unable to find a clear direction. You lose if your string is trapped.

To control your string, use these four keys:

K  right
J  left
M  down
I  up

(See Jun.82 p.10 for info on adding a joystick to your ZX81.–AZ) If you do not push a key for movement, the computer will continue your string to the right. So be careful not to let your lead asterisk double back on itself. Changing line 266 to GOTO 530, 550 or 490 moves the asterisk in another direction if nothing is pressed.

Each symbol is mapped into memory by the POKE command at its corresponding coordinates. B in line 60 is a random memory location for storing information.

The program runs again automatically. To exit, press BREAK.

  50 CLEAR
55 CLS
60 LET B=30000
69 FAST
70 FOR L=2 TO 19
71 FOR M=2 TO 30
72 POKE B+L*40+M,CODE (" ")
73 NEXT M
74 NEXT L
80 RAND
110 FOR N=1 TO 31
120 PRINT AT 21,N;"▞"
130 PRINT AT 1,N;"▞"
140 POKE B+21*40+N,CODE ("▞")
150 POKE B+1*40+N,CODE ("▞")
160 NEXT N
170 FOR N=1 TO 21
180 PRINT AT N,1;"▞"
190 PRINT AT N,31;"▞"
200 POKE B+N*40+1,CODE ("▞")
210 POKE B+N*40+31,CODE ("▞")
220 NEXT N
225 SLOW
230 LET A=INT (RND*16+2)
240 LET C=INT (RND*26+2)
250 PRINT AT A,C;"+"
251 POKE B+A*40+C,CODE ("+")
252 LET D=INT (RND*17+2)
253 LET E=INT (RND*26+2)
254 PRINT AT D,E;"*"
255 POKE B+D*40+E,CODE ("*")
256 LET M$=INKEY$
258 IF M$="K" THEN GOTO 510
259 IF M$="I" THEN GOTO 530
260 IF M$="M" THEN GOTO 550
265 IF M$="J" THEN GOTO 490
266 GOTO 510
270 LET C=C+1
272 IF PEEK (B+A*40+C)<>CODE (" ") THEN GOTO 290
273 PRINT AT A,C;"+"
275 POKE B+A*40+C,CODE ("+")
280 GOTO 256
290 LET C=C-1
300 LET C=C-1
305 IF PEEK (B+A*40+C)<>CODE (" ") THEN GOTO 340
310 PRINT AT A,C;"+"
320 POKE B+A*40+C,CODE ("+")
330 GOTO 256
340 LET C=C+1
341 LET A=A+1
344 IF PEEK (B+A*40+C)<>CODE (" ") THEN GOTO 400
355 PRINT AT A,C;"+"
360 POKE B+A*40+C,CODE ("+")
370 GOTO 256
400 LET A=A-1
403 LET A=A-1
405 IF PEEK (B+(A*40)+C)<>CODE (" ") THEN GOTO 450
410 PRINT AT A,C;"+"
420 POKE B+(A*40)+C,CODE ("+")
430 GOTO 256
450 CLS
460 PRINT AT 10,10;"YOU WIN"
461 PAUSE 100
465 GOTO 50
490 LET E=E-1
500 IF PEEK (B+D*40+E)<>CODE (" ") THEN GOTO 700
501 PRINT AT D,E;"*"
502 POKE B+D*40+E,CODE ("*")
503 GOTO 270
510 LET E=E+1
520 IF PEEK (B+D*40+E)<>CODE (" ") THEN GOTO 700
521 POKE B+D*40+E,CODE ("*")
522 PRINT AT D,E;"*"
523 GOTO 270
530 LET D=D-1
540 IF PEEK (B+D*40+E)<>CODE (" ") THEN GOTO 700
541 POKE B+D*40+E,CODE ("*")
545 PRINT AT D,E;"*"
547 GOTO 270
550 LET D=D+1
560 IF PEEK (B+D*40+E)<>CODE (" ") THEN GOTO 700
565 POKE B+D*40+E,CODE ("*")
570 PRINT AT D,E;"*"
575 GOTO 270
700 CLS
705 PRINT AT 10,12;"YOU LOSE"
715 PAUSE 100
720 GOTO 50
SYNTACTIC SUM: 42089, 8K

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.