10 rem D.M.BROAD. 20 rem SUMMER 1986. 30 : 40 gosub 3000 50 : 70 : 80 gosub 10000: gosub 7000 82 input "ENTER COMMAND";D$ 84 if D$<"L" and D$<>"R" and D$<>"F" and D$<>"C" and D$<>"D" then 82 90 if D$="F" and F=0 then 1000 92 if D$="L" or D$="R" then 2000 93 if D$="D" then graphic0:gosub 6000:getkeyA$:goto80 95 if D$="C" then 3700 500 if DR=1 then PY=PY-1 510 if DR=2 then PX=PX+1 520 if DR=3 then PY=PY+1 530 if DR=4 then PX=PX-1 540 if PX=WD-1 and PY=HE-1 then 3500 550 goto 80 999 : 1000 print "CANT GO THAT WAY":goto82 1010 : 2000 print "TURNING" 2002 if D$="L" then DR=DR-1:if DR=0 then DR=4 2006 if D$="R" then DR=DR+1:if DR=5 then DR=1 2008 goto 80 2010 : 3000 graphic 0 3005 dim MZ%(39,24), D(4) 3010 def fn R(X)= int( rnd(1) *X) 3020 D(0)=0: D(1)=2: D(2)=0: D(3)=-2: D(4)=0 3025 WD=18:HE=18 3030 NN= int(WD/2) * int(HE/2) 3040 print "DESIGNING MAZE..0" 3050 gosub 5000 3055 PX=1:PY=1:DR=2 3060 return 3070 : 3500 graphic0:print "YOU MADE IT!" 3510 end 3520 : 3700 print "YOU'RE POINTING" 3710 if DR=1 then print "NORTH" 3720 if DR=2 then print "EAST" 3730 if DR=3 then print "SOUTH" 3740 if DR=4 then print "WEST" 3750 goto 82 3760 : 4490 rem FIND DIRECTION. 4500 DR= fn R(4)+1 4550 RX= D(DR): RY= D(DR-1) 4560 if PX+RX<0 or PX+RX>=WD or PY+RY<0 or PY+RY>=HE then F=1: else F=0 4570 return 4580 : 5000 PX= int(WD/2): PY= int(HE/2) 5010 SX= PX-2: SY= PY: NS=0: SC=0 5050 gosub 4500: if F goto 5050 5100 MZ%(PX,PY)=1 5110 NS= NS+1: if NS=NN then return 5120 C=0 5125 SC=SC+1:if SC<18 then print "*";:else print chr$(20); 5126 if SC=34 then SC=0:poke 3088,peek(3088)+1 5130 : 5150 if MZ%(PX+RX, PY+RY)=0 then 5500 5200 DR= 1+DR*(DR=4)+DR 5210 gosub 4550: if F goto 5200 5220 C=C+1: if C<4 then 5150 5225 : 5230 C=0: SX=SX+2: if SX>=WD then SX=1: SY=SY+2: if SY>=HE then SY=1 5235 : 5240 if MZ%(SX,SY)=1 then PX=SX: PY=SY: goto 5210: else goto 5230 5250 : 5500 MZ%(PX+RX/2, PY+RY/2)=1 5510 PX= PX+RX: PY= PY+RY 5520 goto 5050 5530 : 6000 scnclr 6005 for Y=0 to HE 6010 for X=0 to WD 6020 A= MZ%(X,Y) 6030 if A=0 then print " ";: else print " "; 6040 next 6050 print 6060 next 6065 poke 3072+PX+40*PY,42 6070 return 6080 : 7000 graphic 2,1 7010 locate 0,0 7020 draw 1 to 100,40 7030 draw 1 to 220,40 7040 draw 1 to 319,0 7050 locate 100,40 7060 draw 1 to 100,100 7070 draw 1 to 220,100 7080 draw 1 to 220,40 7090 locate 100,100 7100 draw 1 to 0,159 7110 locate 220,100 7120 draw 1 to 319,159 7130 draw 1 to 0,159 7140 if F=0 then 8000 7150 locate 140,100 7160 draw 1 to 140,50 7170 draw 1 to 180,50 7180 draw 1 to 180,100 8000 if L=0 then 9000 8010 locate 80,110 8020 draw 1 to 80,55 8030 draw 1 to 50,50 8040 draw 1 to 50,130 9000 if R=0 then 9500 9010 locate 240,110 9020 draw 1 to 240,55 9030 draw 1 to 270,50 9040 draw 1 to 270,130 9500 return 9510 : 10000 A=MZ%(PX,PY-1) 10010 B=MZ%(PX+1,PY) 10020 C=MZ%(PX,PY+1) 10030 D=MZ%(PX-1,PY) 10040 if DR=1 then F=A:L=D:R=B 10050 if DR=2 then F=B:L=A:R=C 10060 if DR=3 then F=C:L=B:R=D 10070 if DR=4 then F=D:L=C:R=A 10080 return 10090 :