Hidden Maze

Developer(s): Bill L. Behrendt
Date: 1983
Type: Program
Platform(s): ZX81, TS 1000
Tags: Game

Find your way north out of a hidden 10 by 15 maze. You start at the bottom; type N, S, E or W. Each square you try is shown, grey if open and black if BLOCKED (you stay where you were). Leaving through the top row ends the game with a score based on the number of moves; you can play again or quit.

RUN it. Needs 16K (on 2K it stops with report 4 at line 50). The maze rows are picked at random from ten patterns in lines 90-180; the article suggests editing those to make it harder.

Lines 9990-9999, printed at the end of the listing without comment, are a short line-renumbering routine: RUN 9990 and enter the first new line number (the prompt says “increment”); it numbers every line before 9990 in steps of 10. It does not change GOTO targets, and it treats any byte 118 inside a line as a line end, which can corrupt a number. It needs a program in front of it: on its own it renumbers itself and breaks.

Adapted from Bill L. Behrendt’s “Maze” in “30 Games” (Micro Text Publications, NY, 1983) and submitted to the newsletter by Will Stackman.

Published in the BCS Sinclair-Timex User Group Newsletter December 1983 (Hidden Maze: a game for the TS1000/1500).

Image Gallery

Source Code

  10 PRINT AT 10,8;"HIDDEN MAZE 10 X 15       FIND YOUR WAY OUT. HEAD NORTH."
  20 PAUSE 120
  30 CLS
  40 RAND INT (RND*20)+1000
  50 DIM M$(10,15)
  60 LET MOVE=0
  70 FOR M=1 TO 10
  80 LET R=INT (RND*10)+1
  90 IF R=1 THEN LET M$(M)="█▒██▒▒▒▒██▒▒███"
 100 IF R=2 THEN LET M$(M)="█▒████▒▒██▒▒▒▒█"
 110 IF R=3 THEN LET M$(M)="███▒▒█▒▒▒▒▒▒█▒█"
 120 IF R=4 THEN LET M$(M)="█▒█▒▒█▒▒▒▒▒▒▒▒█"
 130 IF R=5 THEN LET M$(M)="██▒▒▒▒▒▒██▒▒▒▒█"
 140 IF R=6 THEN LET M$(M)="█▒██▒▒█▒▒▒▒▒▒██"
 150 IF R=7 THEN LET M$(M)="█▒▒▒▒▒▒▒███▒▒▒█"
 160 IF R=8 THEN LET M$(M)="████▒█▒▒▒▒▒██▒█"
 170 IF R=9 THEN LET M$(M)="█▒▒▒██▒▒▒█▒▒▒▒█"
 180 IF R=10 THEN LET M$(M)="█▒▒██▒▒▒█▒▒█▒▒█"
 190 NEXT M
 200 LET X=10
 210 LET Y=5
 220 PRINT AT 0,12;"        "
 230 PRINT AT 0,0;"POSITION: ";X;" X ";Y
 240 PRINT AT 1,0;"N,S,E, OR W?"
 250 INPUT C$
 260 IF C$="N" THEN LET X=X-1
 270 IF C$="S" THEN LET X=X+1
 280 IF C$="E" THEN LET Y=Y+1
 290 IF C$="W" THEN LET Y=Y-1
 300 IF X>10 THEN GOTO 220
 310 IF (Y<1) OR (Y>15) THEN GOTO 220
 320 IF X<1 THEN GOTO 420
 330 LET MOVE=MOVE+1
 340 PRINT AT X+5,Y+5;M$(X,Y)
 350 IF M$(X,Y)="█" THEN PRINT AT 20,0;"BLOCKED"
 360 IF M$(X,Y)<>"█" THEN PRINT AT 20,0;"       "
 370 IF M$(X,Y)="█" THEN IF C$="N" THEN LET X=X+1
 380 IF M$(X,Y)="█" THEN IF C$="S" THEN LET X=X-1
 390 IF M$(X,Y)="█" THEN IF C$="E" THEN LET Y=Y-1
 400 IF M$(X,Y)="█" THEN IF C$="W" THEN LET Y=Y+1
 410 GOTO 220
 420 PRINT "*YOU GOT OUT*"
 430 LET SCORE=INT ((10/MOVE)*100)
 440 PRINT "SCORE=";SCORE
 450 PRINT "  AGAIN? Y/N"
 460 INPUT Y$
 470 IF Y$="Y" THEN GOTO 30
 480 CLS
 490 PRINT AT 10,10;" T.T.F.N. "
 500 STOP
 510 SAVE "MAZXE"
 520 GOTO 10
 530 STOP
9990 LET B=16509
9991 PRINT "ENTER LINE INCREMENT"
9992 INPUT N
9993 POKE B,INT (N/256)
9994 POKE B+1,N-256*INT (N/256)
9995 LET N=N+10
9996 LET B=B+1
9997 IF 256*PEEK B+PEEK (B+1)=9990 THEN STOP
9998 IF PEEK (B-1)=118 THEN GOTO 9993
9999 GOTO 9996

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