Initial map screen.
Program listing on 48K Spectrum.
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 |
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...
|
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.