SPIRAL MAZES


Because you forgot to doff your cap to the local tyrant, you have been thrown into his dungeons.

On the floor, scratched by a previous resident, is a map so now is your chance to escape. Rather than rush headlong into the maze, however, it would be wise to trace your way through in advance. Try drawing a continuous line from where you are to the outside of the dungeons.

By the way, if you make it to the outside, don't forget about doffing the cap next time.

How to play

A maze will be drawn on the screen. At first glance it may appear to be a simple spiral but it may be an optical illusion.

Your position, at the centre, is marked by a red line and you move by pressing the ARROW keys.

Like Dorothy, in the Wizard of Oz, your path will be shown as a yellow line.

When you have decided whether or not your escape is possible press Y for Yes and N for No.

Programming hints

If you wish to change the direction in which the spiral is wound, then you may change the initial values of XS and YS.

If you wish to make the end wall, which blocks off the outside of the maze, run at right angles, then you should change line 320 from PLOT 1,XC, YC to two alternative lines.

   PLOT 1, 0, YC: PLOT 1, XC, 0
and   PLOT 1, XC, 0: PLOT 1, 0, YC

You will have to remember to separate the conditions in lines 280 to 310 to determine in which order the PLOT statements occur.


   10 REM SPIRAL MAZES
   20 REM COPYRIGHT (C) G.LUDINSKI 1983
   30 MODE 5
   40 CLS
   50 WH=INT(RND(1)*2)
   60 PA=(2*INT(RND(1)*8))+8
   70 L=30:W=30:X=600:Y=470
   80 REM
   90 REM DRAW MAZE
  100 REM
  110 FOR J=1 TO 2
  120   XS=1:YS=-1
  130   GCOL0,1:MOVE X-15,Y-15:PLOT 1,30
,0:GCOL0,3
  140   IF J=1 THEN MOVE X,Y:SP=-1:XT=X:
YT=Y
  150   IF J=2 THEN MOVE X,Y:PLOT 1,-W,0
:PLOT 1,0,W:SP=1
  160   FOR I=1 TO PA
  170     IF WH=1 AND J=2 AND I>=(PA-3) 
THEN I=PA:GOTO220
  180     IF I/2=INT(I/2) THEN YP=YS*(L+
(2*INT((I+SP)/2))*W):PLOT1,0,YP:YS=-YS
  190     IF I/2=INT(I/2) AND J=1 THEN Y
T=YT+YP
  200     IF I/2<>INT(I/2) THEN XP=(L+(2
*INT((I+SP)/2))*W)*XS:PLOT1,XP,0:XS=-XS
  210     IF I/2<>INT(I/2) AND J=1 THEN 
XT=XT+XP
  220   NEXTI
  230 NEXTJ
  240 REM
  250 REM BLOCK OFF END OF MAZE
  260 REM
  270 XC=0:YC=0
  280 IF (WH=0 AND XT>X) OR (WH=1 AND XT
<X) THEN XC=-W
  290 IF (WH=0 AND XT<X) OR (WH=1 AND XT
>X) THEN XC=W
  300 IF (WH=0 AND YT>Y) OR (WH=1 AND YT
<Y) THEN YC=-W
  310 IF (WH=0 AND YT<Y) OR (WH=1 AND YT
>Y) THEN YC=W
  320 PLOT1,XC,YC
  330 PRINTTAB(0,1)"Can you escape (Y/N)
"
  340 REM
  350 REM DRAW PATH THROUGH MAZE
  360 REM
  370 PROC_ARROW
  380 REM
  390 REM CHECK ANSWER
  400 REM
  410 PRINTTU$:*FX 21
  420 IF (TU$="Y" AND WH=0) OR (TU$="N" 
AND WH=1) THEN PRINT"You're right.":GOTO
440
  430 PRINT"You're wrong.":FORG=1TO500:N
EXTG:OSCLI("FX 21")
  440 PRINT"More (Y/N)";:I=GET
  450 IFI=78ORI=110 THEN MODE6:OSCLI("FX
 4 0"):OSCLI("FX 11 12"):END ELSE CLS:GO
TO50
  460 REM
  470 DEFPROC_ARROW
  480 MOVE X-20,Y-15
  490 GCOL0,2
  500 *FX 4 1
  510 TU$=GET$
  520 IF TU$="Y" OR TU$="N" THEN 610
  530 X0=0:Y0=0
  540 IF TU$<CHR$(136) OR TU$>CHR$(139) 
THEN GOTO510
  550 IF TU$=CHR$(136) THEN X0=-5
  560 IF TU$=CHR$(137) THEN X0=5
  570 IF TU$=CHR$(138) THEN Y0=-5
  580 IF TU$=CHR$(139) THEN Y0=5
  590 PLOT1,X0,Y0
  600 GOTO510
  610 GCOL0,3
  620 ENDPROC
  780 REM