Labyrin3D

In-game screen.

Initial map screen.

Program listing on 48K Spectrum.

Text Listing

1 CLS :
 DIM m(3e3):
 LET m(INT (RND*5)*2+1430)=USR 7766^0:
 FOR r=1 TO 31:
 FOR s=1 TO 23:
 READ p,z,j,i,w,m(i+i-z*(1<r>r/16)),m(i+i+(s<11)),m(i+i):
 POKE 22496+s*32+r,15*m(i)+(i=p):
 RESTORE :
 NEXT s:
 NEXT r:
 LET k=CODE INKEY$:
 POKE ((s<175)*k<1)*23620,11:
 READ u,u,u,u,u,u,u,u,u,z,j,p,c,d,q:
 BEEP .1,p/46:
 CLS :
 PRINT ,174-s;#1,"NEWS"(2+j/46+(j>0)):
 LET o=m(q):
 LET a=c:
 LET c=(d+d+a)*o-a:
 LET d=INT (d-.3*o*d):
 FOR e=-.5 TO 1:
 LET w=INT (.35*a-d)*(m(q-e*2*j)<o):
 PLOT 128+a*e,88-d-w:
 DRAW (c-a)*e,w:
 DRAW 0,d+d:
 DRAW (a-c)*e,w:
 NEXT e:
 LET q=q+z:
 POKE (p+z<i)*23620,8+9*o*(q<i)*(c>1):
 DATA 110,46,1,r*z+s,RND,w*(r>2)<.7,w>.3,1,(k=54)-(k=55),z+u*(j-z*u),z*(2117*(z*z=1)-1)/46,p+(k=57)*z*m(p+z),250,114,p

Download the game

The Story

Trapped inside a sinister alien maze on a distant planet, you must escape before the battery charge in your spacesuit runs out. It has enough energy left for just another 150 movements, thus you better choose each one wisely. If you manage to successfully reach the planet's featureless surface then you will be able to contact your spaceship for rescue.

Failure to escape within the limited number of moves will result in your untimely demise as you remain permanently frozen, never to be found again...

Instructions

You have 150 turns to escape the maze via the exit located somewhere on the eastern side. When you first RUN the game you will be presented with an overhead map of the maze. Study this carefully whilst you have the chance. Afterwards, press any key to start playing. Keys are 6 - turn left, 7 - turn right, 9 - move forwards, or Sinclair joystick. The direction you are currently facing is indicated by a compass letter at the bottom of the screen and the number of moves remaining is indicated by the number at the top. This is a turn based counter, and there is no time limit on player moves. To win the game, simply escape the maze before the turn counter runs out and the program will end with the usual 0 OK message. However, if the number of turns reaches zero then the player will be frozen within the maze and unable to escape, losing the game. In that case, you can BREAK out of the program and try again.

About the game

This game is purely based on a BASIC listing provided by Einar Saukas which included both the maze generating algorithm and the 3D drawing algorithm. The implementation was based on the original game Lab3D, that Einar co-developed with Eduardo Ito back in the 1980's for ZX-Soft Brasil Ltda. Initial one-liner re-implementation was by Digital Prawn, but the final version was only made possible by continued space saving optimisations and improvements by Einar Saukas and Dr BEEP. Thanks also to bigjon for suggesting the idea of POKEing the attributes file to draw the map of the maze. This was a compact solution which also allowed the maze size to be increased slighlty by using the bottom part of the screen.

This program uses a relatively fast and compact but imperfect maze generation algorithm. This is quite suitable for a one-liner but it can very occasionally produce an unsolvable maze (in practice around 1% of the time). In that rare eventuality, simply restart the program to generate a new maze.

Back to Sinclair stuff index