Compucolor.org – Virtual Media

Listing of file='MAZES.BAS;01' on disk='vmedia/mazes_1-sector.ccvf'

1 REM  LATEST UPDATE:  1-27-80 BY DAVID MATHESON
5 PLOT 12,15
10 PRINT TAB( 15);"A MAZE GENERATING PROGRAM"
20 PRINT TAB( 10);"ADOPTED BY WILLIAM LEE FOR COMPUCOLOR 11"
30 PRINT
100 INPUT "WHAT ARE YOUR WIDTH AND LENGTH (20,12 MAX) ";H,V
102 IF H< > 1AND V< > 1THEN 110
104 PRINT "MEANINGLESS DEMENSTIONS. TRY AGAIN.":GOTO 100
110 DIM W(H,V),V(H,V)
120 PRINT
160 Q= 0:Z= 0:X= INT (RND (1)* H+ 1)
165 FOR I= 1TO H
170 IF I= XTHEN 173
171 PRINT ".--";:GOTO 180
173 PRINT ".  ";
180 NEXT I
190 PRINT "."
195 C= 1:W(X,1)= C:C= C+ 1
200 R= X:S= 1:GOTO 260
210 IF R< > HTHEN 240
215 IF S< > VTHEN 230
220 R= 1:S= 1:GOTO 250
230 R= 1:S= S+ 1:GOTO 250
240 R= R+ 1
250 IF W(R,S)= 0THEN 210
260 IF R- 1= 0THEN 530
265 IF W(R- 1,S)< > 0THEN 530
270 IF S- 1= 0THEN 390
280 IF W(R,S- 1)< > 0THEN 390
290 IF R= HTHEN 330
300 IF W(R+ 1,S)< > 0THEN 330
310 X= INT (RND (1)* 3+ 1)
320 ON XGOTO 790,820,860
330 IF S< > VTHEN 340
334 IF Z= 1THEN 370
338 Q= 1:GOTO 350
340 IF W(R,S+ 1)< > 0THEN 370
350 X= INT (RND (1)* 3+ 1)
360 ON XGOTO 790,820,910
370 X= INT (RND (1)* 2+ 1)
380 ON XGOTO 790,820
390 IF R= HTHEN 470
400 IF W(R+ 1,S)< > 0THEN 470
405 IF S< > VTHEN 420
410 IF Z= 1THEN 450
415 Q= 1:GOTO 430
420 IF W(R,S+ 1)< > 0THEN 450
430 X= INT (RND (1)* 3+ 1)
440 ON XGOTO 790,860,910
450 X= INT (RND (1)* 2+ 1)
460 ON XGOTO 790,860
470 IF S< > VTHEN 490
480 IF Z= 1THEN 520
485 Q= 1:GOTO 500
490 IF W(R,S+ 1)< > 0THEN 520
500 X= INT (RND (1)* 2+ 1)
510 ON XGOTO 790,910
520 GOTO 790
530 IF S- 1= 0THEN 670
540 IF W(R,S- 1)< > 0THEN 670
545 IF R= HTHEN 610
547 IF W(R+ 1,S)< > 0THEN 610
550 IF S< > VTHEN 560
552 IF Z= 1THEN 590
554 Q= 1:GOTO 570
560 IF W(R,S+ 1)< > 0THEN 590
570 X= INT (RND (1)* 3+ 1)
580 ON XGOTO 820,860,910
590 X= INT (RND (1)* 2+ 1)
600 ON XGOTO 860
610 IF S< > VTHEN 630
620 IF Z= 1THEN 660
625 Q= 1:GOTO 640
630 IF W(R,S+ 1)< > 0THEN 660
640 X= INT (RND (1)* 2+ 1)
650 ON XGOTO 820,910
660 GOTO 820
670 IF R= HTHEN 740
680 IF W(R+ 1,S)< > 0THEN 740
685 IF S< > VTHEN 700
690 IF Z= 1THEN 730
695 Q= 1:GOTO 830
700 IF W(R,S+ 1)< > 0THEN 730
710 X= INT (RND (1)* 2+ 1)
720 ON XGOTO 860,910
730 GOTO 860
740 IF S< > VTHEN 760
750 IF Z= 1THEN 780
755 Q= 1:GOTO 770
760 IF W(R,S+ 1)< > 0THEN 780
770 GOTO 910
780 GOTO 1000
790 W(R- 1,S)= C
800 C= C+ 1:V(R- 1,S)= 2:R= R- 1
810 IF C= H* V+ 1THEN 1010
815 Q= 0:GOTO 260
820 W(R,S- 1)= C
830 C= C+ 1
840 V(R,S- 1)= 1:S= S- 1:IF C= H* V+ 1THEN 1010
850 Q= 0:GOTO 260
860 W(R+ 1,S)= C
870 C= C+ 1:IF V(R,S)= 0THEN 880
875 V(R,S)= 3:GOTO 890
880 V(R,S)= 2
890 R= R+ 1
900 IF C= H* V+ 1THEN 1010
905 GOTO 530
910 IF Q= 1THEN 960
920 W(R,S+ 1)= C:C= C+ 1:IF V(R,S)= 0THEN 940
930 V(R,S)= 3:GOTO 950
940 V(R,S)= 1
950 S= S+ 1:IF C= H* V+ 1THEN 1010
955 GOTO 260
960 Z= 1
970 IF V(R,S)= 0THEN 980
975 V(R,S)= 3:Q= 0:GOTO 1000
980 V(R,S)= 1:Q= 0:R= 1:S= 1:GOTO 250
1000 GOTO 210
1010 FOR J= 1TO V
1011 PRINT "I";
1012 FOR I= 1TO H
1013 IF V(I,J)< 2THEN 1030
1020 PRINT "   ";
1021 GOTO 1040
1030 PRINT "  I";
1040 NEXT I
1041 PRINT
1043 FOR I= 1TO H
1045 IF V(I,J)= 0THEN 1060
1050 IF V(I,J)= 2THEN 1060
1051 PRINT ":  ";
1052 GOTO 1070
1060 PRINT ":--";
1070 NEXT I
1071 PRINT "."
1072 NEXT J
1100 P= 28700
1110 PLOT 8
1120 PLOT 14,11,10,11,15,8
1125 POKE P,42:POKE P+ 1,5
1200 REM  START OF MOVEMENT LOOP
1210 PLOT 8,29,16
1220 X= PEEK (28672)
1230 IF X= 50THEN 1300
1240 IF X= 52THEN 1350
1250 IF X= 54THEN 1400
1260 IF X= 56THEN 1450
1270 GOTO 1210
1300 P1= P+ 128
1310 GOTO 1500
1350 P1= P- 2
1360 GOTO 1500
1400 P1= P+ 2
1410 GOTO 1500
1450 P1= P- 128
1500 IF P1< 28672THEN 1210
1510 IF P1> 32766THEN 1210
1520 Q= PEEK (P1)
1525 IF Q= 46OR Q= 73OR Q= 58OR Q= 45THEN 1210
1530 POKE P,32:POKE P1,42:POKE P1+ 1,5
1540 P= P1
1550 IF P< 32766- 128THEN 1210
1560 PRINT "YAY, YOU MADE IT!!!!!!!!"