home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Avalon 6
/
Avalon_06_1995_Avalon_Side_B.d64
/
labyrinth
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
9KB
|
452 lines
10 c0=0:c1=1:c2=2:c3=3:c4=4:c5=5:c6=6:c7=7:c8=8:c9=9
20 sc=1024:ll=40
30 dima(19,11),b(19,11)
40 a$(1)="north":a$(2)="east":a$(3)="south":a$(4)="west"
50 w$="[177][178][177][178][177][178][177][178][177][178][177][178][177][178][177][178][177][178][177][178][177][178][177][178]"
60 sp$=" "
70 m1=c0:print"[147]enter dimensions of labyrinth:"
80 input"how wide";h
90 ifh=c0orh>19thenprint"[145][145]";:goto80
100 input"how deep";v
110 ifv=c0orv>10thenprint"[145][145]";:goto100
120 print"now creating a"h"x"v"labyrinth
130 a[178]h[172]v[170]c1
140 q[178]c0:z[178]c0:x[178][181](h[172][187](h))[170]c1
150 aa[178]x
160 a(x,0)[178]c1:c[178]c2
170 r[178]x:s[178]c1:[137]240
180 [139]r[179][177]h[137]220
190 [139]s[179][177]v[137]210
200 r[178]c1:s[178]c1:[137]230
210 r[178]c1:s[178]s[170]c1:[137]230
220 r[178]r[170]c1
230 [139]a(r,s[171]c1)[178]c0[137]180
240 [139]r[171]c1[178]c0[137]560
250 [139]a(r[171]c1,s[171]c1)[137]560
260 [139]s[171]c1[178]c0[137]400
270 [139]a(r,s[171]c2)[137]400
280 [139]r[178]h[137]320
290 [139]a(r[170]c1,s[171]c1)[137]320
300 x[178][181](c3[172][187](c1))[170]c1
310 [145]x[137]870,910,950
320 [139]s[179][177]v[137]350
330 [139]z[178]c1[137]380
340 q[178]c1:[137]360
350 [139]a(r,s)[137]380
360 x[178][181](c3[172][187](c1))[170]c1
370 [145]x[137]870,910,1020
380 x[178][181](c2[172][187](c1))[170]c1
390 [137]370
400 [139]r[178]h[137]500
410 [139]a(r[170]c1,s[171]c1)[137]500
420 [139]s[179][177]v[137]450
430 [139]z[178]c1[137]480
440 q[178]c1:[137]460
450 [139]a(r,s)[137]480
460 x[178][181](c3[172][187](c1))[170]c1
470 [145]x[137]870,950,1020
480 x[178][181](c2[172][187](c1))[170]c1
490 [137]470
500 [139]s[179][177]v[137]530
510 [139]z[178]c1[137]870
520 q[178]c1:[137]540
530 [139]a(r,s)[137]870
540 x[178][181](c2[172][187](c1))[170]c1
550 [145]x[137]870,1020
560 [139]s[171]c1[178]c0[137]740
570 [139]a(r,s[171]c2)[137]740
580 [139]r[178]h[137]680
590 [139]a(r[170]c1,s[171]c1)[137]680
600 [139]s[179][177]v[137]630
610 [139]z[178]c1[137]660
620 q[178]c1:[137]640
630 [139]a(r,s)[137]660
640 x[178][181](c3[172][187](c1))[170]c1
650 [145]x[137]910,950,1020
660 x[178][181](c2[172][187](c1))[170]c1
670 [137]650
680 [139]s[179][177]v[137]710
690 [139]z[178]c1[137]910
700 q[178]c1:[137]720
710 [139]a(r,s)[137]910
720 x[178][181](c2[172][187](c1))[170]c1
730 [145]x[137]910,1020
740 [139]r[178]h[137]820
750 [139]a(r[170]c1,s[171]c1)[137]820
760 [139]s[179][177]v[137]790
770 [139]z[178]c1[137]950
780 q[178]c1:[137]800
790 [139]a(r,s)[137]950
800 x[178][181](c2[172][187](c1))[170]c1
810 [145]x[137]950,1020
820 [139]s[179][177]v[137]850
830 [139]z[178]c1[137]180
840 q[178]c1:[137]860
850 [139]a(r,s)[137]180
860 [137]1020
870 a(r[171]c1,s[171]c1)[178]c
880 c[178]c[170]c1:b(r[171]c1,s[171]c1)[178]c2:r[178]r[171]c1
890 [139]c[178]a[137]1120
900 q[178]c0:[137]240
910 a(r,s[171]c2)[178]c
920 c[178]c[170]c1
930 b(r,s[171]c2)[178]c1:s[178]s[171]c1:[139]c[178]a[137]1120
940 q[178]c0:[137]240
950 a(r[170]c1,s[171]c1)[178]c
960 c[178]c[170]c1:[139]b(r,s[171]c1)[178]c0[137]980
970 b(r,s[171]c1)[178]c3:[137]990
980 b(r,s[171]c1)[178]c2
990 r[178]r[170]c1
1000 [139]c[178]a[137]1120
1010 [137]560
1020 [139]q[178]c1[137]1080
1030 a(r,s)[178]c:c[178]c[170]c1:[139]b(r,s[171]c1)[178]c0[137]1050
1040 b(r,s[171]c1)[178]c3:[137]1060
1050 b(r,s[171]c1)[178]c1
1060 s[178]s[170]c1:[139]c[178]a[137]1120
1070 [137]240
1080 z[178]c1
1090 [139]b(r,s[171]c1)[178]c0[137]1110
1100 b(r,s[171]c1)[178]c3:q[178]c0:[137]180
1110 b(r,s[171]c1)[178]c1:q[178]c0:r[178]c1:s[178]c1:[137]230
1120 [139]z[179][177]c1[167]x[178][181](h[172][187](c1))[170]c1:b(x,v[171]c1)[178]b(x,v[171]c1)[170]c1
1130 [141]1140:[151]sc[170]12[172]ll[170]18[171]h[170]ll[172]v[170]2[172]aa,30:[137]1410
1140 [143] print maze ***
1150 m1[178]c1:[153]"load";:[139]v[178]11[167]1170
1160 [129]i[178]c1[164]11[171]v:[153]:[130]
1170 [129]j[178]v[164]c1[169][171]c1:[153][166]19[171]h)
1180 [129]i[178]c1[164]h:[153]" ";
1190 [139]b(i,j[171]c1)[178]c0[137]1230
1200 [139]b(i,j[171]c1)[178]c2[137]1230
1210 [153]"stop ";
1220 [137]1240
1230 [153]" ";
1240 [130]i
1250 [153]" ":[143] finish line
1260 [153][166]19[171]h)" ";
1270 [129]i[178]c1[164]h:[153]"stop ";
1280 [139]b(i,j[171]c1)[179]c2[137]1310
1290 [153]"stop ";
1300 [137]1320
1310 [153]" ";
1320 [130]i:[153]
1340 [130]j
1350 [153][166]19[171]h)"";:[129]i[178]c1[164]h
1360 [139]i[178]aa[137]1380
1370 [153]" ";:[137]1390
1380 [153]" stop ";
1390 [130]i
1400 [153]" ":[142]
1410 w[178]aa
1420 [129]j[178]c0[164]v[171]c1
1430 [129]i[178]c1[164]h
1440 [139]j[137]1470
1450 [139]i[178]w[167]a(i,j)[178](c3[171]b(i,j))[172]c2:[137]1490
1460 m[178]c1:[137]1480
1470 m[178](a(i,j[171]c1)[175]2)[173]c2
1480 a(i,j)[178](c3[171]b(i,j))[172]c2[170]m[172]c8
1490 [139]i[178]c1[167]m[178]c1:[137]1510
1500 m[178](a(i[171]c1,j)[175]4)[173]c4
1510 a(i,j)[178]a(i,j)[170]m
1520 [130]i
1530 [130]j
1540 [153]"load";
1550 x[178]w:y[178]c0:z[178]c1:el[178]c1:er[178]c1
1560 [137]2260
1570 [153]"you can give the following instructions:";
1580 [153]"fwait-move forwards one block;"
1590 [153]"lwait-turn leftclose90 degress;"
1600 [153]"rwait-turn rightclose90 degrees;"
1610 [153]"hwait-help!"
1620 [142]
1630 [141]1140:[153]"you are here spc(, facing "a$(z)
1640 [151]sc[170]ll[172]12[170]18[171]h[170]ll[172]v[170]2[172]x[171](ll[172]2)[172]y,102
1650 [139]y[177]v[137]4520
1660 [153]"what now?";
1670 [161]z$:[139]z$[178]""[137]1670
1680 [139]z$[178]"l"[137]1730
1690 [139]z$[178]"r"[137]1750
1700 [139]z$[178]"f"[137]2210
1710 [139]z$[178]"h"[137]1630
1720 [137]1670
1730 z[178]z[171]c1:[139]z[179]c1[167]z[178]z[170]c4
1740 [137]2260
1750 z[178]z[170]c1:[139]z[177]c4[167]z[178]z[171]c4
1760 [137]2260
1770 [142]
1780 [139]z[178]c1[167]a1[178]a[171]c1:b1[178]b[171]c1:[137]1830
1790 [139]z[178]c2[175]b[179]v[167]a1[178]a:b1[178]b:[137]1830
1800 [139]z[178]c3[167]a1[178]a[170]c1:b1[178]b[171]c1:[137]1830
1810 [139]z[178]c4[175]b[177]c1[167]a1[178]a:b1[178]b[171]c2:[137]1830
1820 el[178]c1:[142]
1830 f[178]a(a1,b1):[139]z[178]c1[137]1850
1840 [129]i[178]c2[164]z:f[178](f[175]14)[173]c2[170](f[175]c1)[172]c8:[130]
1850 el[178](f[175]c2)[173]c2:[142]
1860 [139]z[178]c1[167]a1[178]a[170]c1:b1[178]b[171]c1:[137]1910
1870 [139]z[178]c2[175]b[177]c1[167]a1[178]a:b1[178]b[171]c2:[137]1910
1880 [139]z[178]c3[167]a1[178]a[171]c1:b1[178]b[171]c1:[137]1910
1890 [139]z[178]c4[175]b[179]v[167]a1[178]a:b1[178]b:[137]1910
1900 er[178]c1:[142]
1910 f[178]a(a1,b1):[139]z[178]c1[137]1930
1920 [129]i[178]c2[164]z:f[178](f[175]14)[173]c2[170](f[175]c1)[172]c8:[130]
1930 er[178](f[175]c2)[173]c2:[142]
1940 [139]b[178]c0[137]2020
1950 [139]b[177]v[167]e[178]c3:[142]
1960 f[178]a(a,b[171]c1):[139]z[178]c1[137]1980
1970 [129]i[178]c2[164]z:f[178](f[175]14)[173]c2[170](f[175]c1)[172]c8:[130]
1980 c[178]f[175]c1:d[178](f[175]4)[173]c4:e[178](f[175]2)[173]c2
1990 [139]c[178]c0[167][141]1780
2000 [139]d[178]c0[167][141]1860
2010 [142]
2020 c[178]c0:d[178]c0:e[178][171]c1
2030 [139]z[179][177]1[137]2070
2040 e[178]c1
2050 [139]a[178]w[167]e[178]c0
2060 [142]
2070 [139]z[178]c3[167]e[178]c2:[142]
2080 [139]z[178]c2[175]a[178]h[167]e[178]c2:[142]
2090 [139]z[178]c4[175]a[178]c1[167]e[178]c2:[142]
2100 [142]
2110 [139]e[177]c0[137]2170
2120 [139]z[178]c1[167]b[178]b[170]c1:[142]
2130 [139]z[178]c2[167]a[178]a[170]c1:[142]
2140 [139]z[178]c3[167]b[178]b[171]c1:[142]
2150 [139]z[178]c4[167]a[178]a[171]c1:[142]
2160 [153]"";:[142]
2170 [139]e[178]c0[137]2190
2180 [153]"";
2190 s[178]c1
2200 [142]
2210 a[178]x:b[178]y
2220 [141]1940
2230 [141]2110
2240 x[178]a:y[178]b
2250 [139]e[177]c0[137]1650
2260 a[178]x:b[178]y
2270 [141]1940
2280 [143] display 5 depths
2290 [129]t[178]c1[164]5
2300 [141]2410
2310 [139]e[167]t[178]c5:[137]2350
2320 [141]2110
2330 [141]1940
2340 [139]e[177]c1[167]t[178]c5:[137]2350
2350 [130]t
2360 [139]x[178]w[175]y[178]c0[175]z[178]c1[137]2400
2370 [139]x[179][177]w[175]y[178]c0[175]z[178]c1[167][141]2160:[153]"ononononexternal wall":[137]2390
2380 [137]2400
2390 [141]2160:[153]"ononyou're outside!
2400 goto1650
2410 ontgoto2420,2780,3220,3710,4250
2420 rem display depth 1
2430 print"[147]";
2440 ife>c2thenreturn
2450 ife<c0ore>c1thengosub2180:return
2460 fori=c1to21:ifc=c1thenprint"[167]";:goto2520
2470 ify=c0thenprint""mid$(w$,(iandc1)+c1,c8);:goto2520
2480 ifel=c1thenprint"[166][166][166][166][166][166][166][166]";:goto2520
2490 ifi=c2thenprint"[164][164][164][164][164][164][164][166]";:goto2520
2500 ifi<18thenprint"[166]";:goto2520
2510 print" [146][166]";
2520 ife=c0thenprintspc(22);:goto2550
2530 ify=c0thenprint""mid$(w$,(iandc1)+c1,22);:goto2550
2540 print"[166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166]";
2550 ifd=c1thenprint"[165]":goto2610
2560 ify=c0thenprint""mid$(w$,(iandc1)+c1,c8):goto2610
2570 ifer=c1thenprint"[166][166][166][166][166][166][166][166]":goto2610
2580 ifi=c2thenprint"[166][164][164][164][164][164][164][164]":goto2610
2590 ifi<18thenprint"[166]":goto2610
2600 print"[166] "
2610 next
2620 fori=c1toc3:ifc=c1or(x=wandy=c0)goto2680
2630 ifi<>c1then2650
2640 ifel=c0thenprint"[163][163][163][163][163][163][163][206]";:goto2690
2650 print""left$(sp$,c8-i)"[206]"left$(sp$,i-c1);
2660 ifi=c1goto2690
2670 goto2700
2680 printspc(c9-i)"[169]"left$(sp$,i-c1);:ifi<>c1then2700
2690 ife=c0thenprint"[163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163]";:goto2710
2700 print" ";
2710 ifd=c1or(x=wandy=c0)goto2750
2720 ifi<>c1then2740
2730 ifer=c0thenprint"[205][163][163][163][163][163][163][163]":goto2760
2740 print""left$(sp$,i-c1)"[205]"left$(sp$,c8-i):goto2760
2750 print""left$(sp$,i-c1)"[223]"
2760 nexti
2770 return
2780 rem display depth 2
2790 print"";:z$=""
2800 fori=c1toc2:printz$;:ifc=c0goto2830
2810 printspc(i+c1)"[205]";spc(c2-i);:goto2860
2820 print"[205]";:goto2860
2830 ifi=c1thenprintspc(c4):goto2860
2840 ifel=c1thenprint"[164][164][164][164]";:goto2860
2850 print"[164]";
2860 ife=c0ori=c1thenprintspc(14);:goto2880
2870 print"[164][164][164][164][164][164][164][164][164][164][164][164][164][164]";
2880 ifd=c0goto2900
2890 printspc(c2-i)"[206]":goto2930
2900 ifi=c1thenprint:goto2930
2910 ifer=c1thenprint"[164][164][164][164]":goto2930
2920 print"[164]"
2930 next
2940 fori=c1to15:printz$;:ifc=c1thenprint"[167]";:goto2990
2950 ifel=c1thenprint"[166][166][166][166][146]";:goto2990
2960 ifi=c3thenprint"[164][164][164][166][146]";:goto2990
2970 ifi>12thenprint" [166][146]";:goto2990
2980 print" [166][146]";
2990 ife=c0thenprint"";:goto3010
3000 print"[166][166][166][166][166][166][166][166][166][166][166][166][166][166][146]";
3010 ifd=c1thenprint"[165]":goto3060
3020 ifer=c1thenprint"[166][166][166][166]":goto3060
3030 ifi=c3thenprint"[166][146][164][164][164]":goto3060
3040 ifi>12thenprint"[166] ":goto3060
3050 print"[166]"
3060 next
3070 fori=c1to4:printz$;:ifc=c1goto3120
3080 ifi<>c1goto3110
3090 ifel=c0thenprint"[163][163][163][206]";:goto3130
3100 print" [206]";:goto3130
3110 print""left$(sp$,c4-i)"[206]"left$(sp$,i-c1);:goto3140
3120 printspc(c4-i)"[169]"left$(sp$,i-c1);:ifi<>c1then3140
3130 ife=c0thenprint"[163][163][163][163][163][163][163][163][163][163][163][163][163][163]";:goto3150
3140 print" ";
3150 ifd=c1goto3190
3160 ifi<>c1then3180
3170 ifer=c0thenprint"[205][163][163][163]":goto3200
3180 print""left$(sp$,i-c1)"[205]"left$(sp$,c4-i):goto3200
3190 print""left$(sp$,i-c1)"[223]":goto3200
3200 nexti
3210 return
3220 rem display depth 3
3230 print"";:z$=z$+""
3240 fori=c1to3:printz$;:ifc=c0goto3260
3250 printspc(i-c1)"[205]"spc(c3-i);:goto3290
3260 ifi<c3thenprint"";:goto3290
3270 ifel=c1thenprint"[164][164][164]";:goto3290
3280 print"[164]";
3290 ife=c0ori<=c2thenprint"";:goto3310
3300 print"[164][164][164][164][164][164][164][164]";
3310 ifd=c0goto3330
3320 printspc(3-i)"[206]":goto3360
3330 ifi<c3thenprint:goto3360
3340 ifer=c1thenprint"[164][164][164]":goto3360
3350 print"[164]"
3360 next
3370 fori=c1to9:printz$;:ifc=c1thenprint"[167]";:goto3420
3380 ifel=c1thenprint"[166][166][166]";:goto3420
3390 ifi=c2thenprint"[164][164][166]";:goto3420
3400 ifi>c7thenprint" [146][166]";:goto3420
3410 print" [166]";
3420 ife=c0thenprint"";:goto3440
3430 print"[166][166][166][166][166][166][166][166]";
3440 ifd=c1thenprint"[165]":goto3490
3450 ifer=c1thenprint"[166][166][166]":goto3490
3460 ifi=c2thenprint"[166][164][164]":goto3490
3470 ifi>c7thenprint"[166] [146]":goto3490
3480 print"[166]"
3490 next
3500 fori=c1to3:printz$;:ifc=c1goto3560
3510 ifi<>c1then3530
3520 ifel=c0thenprint"[163][163][206]";:goto3570
3530 print""left$(sp$,c3-i)"[206]"left$(sp$,i-c1);
3540 ifi=c1then3570
3550 goto3580
3560 printspc(c3-i)"[169]"left$(sp$,i-c1);:goto3540
3570 ife=c0thenprint"[163][163][163][163][163][163][163][163]";:goto3590
3580 print" ";
3590 ifd=c1goto3650
3600 ifi<>c1then3620
3610 ifer=c0thenprint"[205][163][163]":goto3690
3620 print""left$(sp$,i-c1)"[205]"left$(sp$,c3-i):goto3690
3650 print""left$(sp$,i-c1)"[223]"
3690 nexti
3700 return
3710 rem display depth 4
3720 print"";:z$=z$+""
3730 fori=c1to2:printz$;:ifc=c0goto3770
3740 printspc(i-c1)"[205]"spc(c2-i);:goto3810
3770 ifi=c1thenprint"";:goto3810
3790 ifel=c1thenprint"[164][164]";:goto3810
3800 print"[164]";
3810 ife=c0ori=c1thenprint"";:goto3830
3820 print"[164][164][164][164]";
3830 ifd=c0goto3870
3840 ifi=c1thenprint"";
3850 print"[206]":goto3910
3870 ifi=c1thenprint:goto3910
3890 ifer=c1thenprint"[164][164]":goto3910
3900 print"[164]"
3910 next
3920 fori=c1to5:printz$;:ifc=c1thenprint"[167]";:goto3970
3930 ifel=c1thenprint"[166][166][146]";:goto3970
3940 ifi=c1thenprint"[164][166][146]";:goto3970
3950 ifi>4thenprint"[163][166][146]";:goto3970
3960 print" [166][146]";
3970 ife=c0thenprint"";:goto3990
3980 print"[166][166][166][166][146]";
3990 ifd=c1thenprint"[165]":goto4040
4000 ifer=c1thenprint"[166][166]":goto4040
4010 ifi=c1thenprint"[166][146][164]":goto4040
4020 ifi>c4thenprint"[166] ":goto4040
4030 print"[166]"
4040 next
4050 fori=c1to2:printz$;:ifc=c1goto4100
4060 ifi<>c1then4080
4070 ifel=c0thenprint"[163][206]";:goto4130
4080 print""left$(sp$,c2-i)"[206]"left$(sp$,i-c1);
4085 ifi=c1then4130
4090 goto4140
4100 ifi=c1thenprint"";
4110 print"[169]";
4120 ifi=c2thenprint" ";:goto4140
4130 ife=c0thenprint"[163][163][163][163]";:goto4150
4140 print" ";
4150 ifd=c1goto4200
4160 ifi<>c1then4180
4170 ifer=c0thenprint"[205][163]":goto4230
4180 print""left$(sp$,i-c1)" "left$(sp$,c2-i):goto4230
4200 print"";:ifi=c2thenprint" ";
4210 print"[223]"
4230 nexti
4240 return
4250 rem display depth 5
4260 print"";:z$=z$+""
4270 printz$;:ifc=c0goto4290
4280 print"[205]";:goto4300
4290 print"[164]";
4300 ife=c0thenprint"";:goto4320
4310 print"[164][164]";
4320 ifd=c0goto4340
4330 print"[206]":goto4350
4340 print"[164]"
4350 fori=c1to3:printz$;:ifc=c1goto4370
4360 print"[166]";:goto4380
4370 print"[167]";
4380 ife=c0thenprint"";:goto4400
4390 print"[166][166]";
4400 ifd=c0thenprint"[166]":goto4420
4410 print"[165]"
4420 next
4430 printz$;:ifc=c1goto4450
4440 print"[206]";:goto4460
4450 print"[169]";
4460 ife=c1thenprint" ";:goto4480
4470 print"[163][163]";
4480 ifd=c1goto4500
4490 print"[205]":goto4510
4500 print"[223]"
4510 return
4520 print"[147]you're out!
4530 [139]m1[167][153]"":[137]4560
4540 [153]"loadhere is the maze":[141]1780
4550 [141]1140
4560 [133]"another game";z$
4570 [139]z$[178]"y"[137]70
4580 [128]
4590 [129]i[178]0[164]10:[129]j[178]0[164]19
4600 [153][201]("0"[170][202]([196](a(j,i)),2),2)"";:[130]j:[153]:[130]i
4610 [153]:[153]
4620 [129]j[178]v[171]1[164]0[169][171]1:[129]i[178]1[164]h
4630 [153][201]("0"[170][202]([196](b(i,j)),2),2)"";:[130]i:[153]:[130]j