Minotaur

Developer(s): Fred Nachbaur
Date: 1983
Type: Program
Platform(s): TS 1000
Tags: Game

Draws a random maze across the whole screen and puts you (O) in the bottom-left corner, with the exit marked FINISH at top right and the Minotaur (an inverse M) somewhere in between. You move with the cursor keys 5–8. You leave a trail of ▒ squares that you can’t cross again, and the Minotaur leaves a trail of quote marks. A density value between 0 and 1 sets both the share of walls and how often the Minotaur moves at random instead of heading toward you. Key 1 starts a new maze.

The title screen reads “"MINOTAUR" by F.NACHBAUR”. Fred Nachbaur’s program was published as a type-in in Sync, March/April 1983 (v. 3, no. 2). The handwritten label reads “MINOTAUR”.

Program Analysis

Program Structure

  • Line 10: INPUT DN, the density, with no prompt.
  • Lines 20–160: fill the screen with inverse spaces, show the title, then in FAST mode POKE rows 1–20, columns 2–31 of the display file with walls or spaces ((RND<DN)*128). Corner areas at the start and the finish are cleared.
  • Lines 200–220: label FINISH and set your start position.
  • Lines 380–550: place the Minotaur at random, then move it one step toward you, or one step in a random direction if RND>1-DN. Moves into walls are undone.
  • Lines 620–740: read the keys, draw both trails, check walls, draw both figures, and test for escape or capture.
  • Lines 820–1105: end messages, a “PRESS P TO PLAY” loop, and the SAVE.

Notable Techniques

  • Every constant is a variable saved with the program: O=0, P=1, Q=2, R=3, S=5, T=20, U=31, L=33, V=128, J=512, K=16396. Lines such as GOTO J-T, GOTO T*U and POKE DF+H*L+I use them in place of numbers, which saves memory.
  • The maze lives only in the display file. DF=PEEK K+Q*V*PEEK (K+P) reads D_FILE, and wall and trail checks are PEEKs of the screen cell (33 bytes per row).
  • One input, DN, sets both the maze density and the Minotaur’s chance of a random move, so a denser maze also means a less predictable pursuer.
  • The Minotaur can move diagonally (both coordinates step at once), while you move one axis at a time.

Potential Issues

  • As recorded, the escape test at line 728 looks for row 0, column 31, which is a border wall that the move check at line 680 never lets you enter. It and the capture test at line 730 branch with GOTO U and GOTO T*Q, both of which land on line 40 and redraw the maze. The “YOU WERE EATEN” and “YOU ESCAPED” messages at 820 and 961, and the replay prompt after them, are never reached.
  • Starting with RUN clears the saved constant variables, and line 40 then stops with an undefined variable. The program has to be started with GOTO. After loading, it continues from line 1105 (GOTO T, line 20) using the saved density of 0.3. To choose a new density, use GOTO 10.

Related Articles

This active-animation program displays a full-screen picture of a maze, and shows your progress through it to its only exit....

Image Gallery

Source Code

  10 INPUT DN
  20 CLS
  30 FAST
  40 FOR A=P TO V-T-T
  50 PRINT "████████";
  60 NEXT A
  70 PRINT AT S,U-T;"""MINOTAUR""";AT U-T,U-T;"[B][Y]█[F][.][N][A][C][H][B][A][U][R]"
  80 PAUSE V+V
  90 LET DF=PEEK K+Q*V*PEEK (K+P)
 100 FOR H=P TO T
 110 FOR I=Q TO U
 120 POKE DF+H*L+I,(RND<DN)*V
 130 IF (H<R+P AND I>U-Q) OR (H>T-R AND I<S) THEN POKE DF+H*L+I,O
 140 NEXT I
 150 NEXT H
 160 SLOW
 200 PRINT AT O,T+R;"[F][I][N][I][S][H] "
 210 LET D=T
 220 LET E=Q
 380 LET H=INT (RND*T+P)
 390 LET I=INT (RND*T+S)
 400 LET B=D
 410 LET C=E
 430 LET F=H
 440 LET G=I
 450 IF RND>(P-DN) THEN GOTO J-T
 460 LET H=H+SGN (D-H)
 470 LET I=I+SGN (E-I)
 480 GOTO J+T
 492 LET H=H+INT (RND*R-P)
 500 LET I=I+INT (RND*R-P)
 510 LET H=H+(H=O)
 532 IF PEEK (DF+H*L+I)<V THEN GOTO T*U
 540 LET H=F
 550 LET I=G
 620 LET D=D-(INKEY$ ="7")+(INKEY$ ="6")
 630 LET E=E-(INKEY$ ="5")+(INKEY$ ="8")
 640 IF INKEY$ ="1" THEN GOTO T
 670 POKE DF+B*L+C,R+S
 675 POKE DF+F*L+G,U-T
 680 IF PEEK (DF+D*L+E)<V AND PEEK (DF+D*L+E)<>R+S THEN GOTO 720
 700 LET D=B
 710 LET E=C
 720 POKE DF+D*L+E,52
 725 POKE DF+H*L+I,178
 728 IF D=0 AND E=U THEN GOTO U
 730 IF D=H AND E=I THEN GOTO T*Q
 740 GOTO T*T
 820 PRINT AT T+P,O;"[Y][O][U]█[W][E][R][E]█[E][A][T][E][N][.]█";
 830 GOTO U*L
 961 PRINT AT T+P,O;"[*][*][*][Y][O][U]█[E][S][C][A][P][E][D][*][*]";
1023 PRINT "[P][R][E][S][S]█[P]█[T][O]█[P][L][A][Y]"
1030 IF INKEY$ <>"P" THEN GOTO J*Q
1050 GOTO T
1100 SAVE "MINOTAU[R]"
1105 GOTO T

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