home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG055.ARC
/
MAZE.BAS
< prev
next >
Wrap
BASIC Source File
|
1979-12-31
|
2KB
|
79 lines
100 REM WRITTEN BY JACK HAUBER UPDATED 5-21-77 D. NIXON
110 WIDTH 80
120 DEFINT A-Z
130 PRINT "THIS PROGRAM WILL PRINT OUT A DIFFERENT MAZE EVERY TIME IT"
140 PRINT "IS RUN AND GUARANTEES ONLY ONE PATH THROUGH. YOU CAN CHOOSE"
150 PRINT "THE DIMENSIONS OF THE MAZE. I.E. THE NUMBER OF SQUARES WIDE"
160 PRINT "AND THE NUMBER OF SQUARES LONG."
170 PRINT
180 PRINT "WHAT ARE YOUR WIDTH AND LENGTH";
190 INPUT H,V
200 DIM W(H,V),V(H,V)
210 PRINT
220 IF H>2 AND V>2 THEN 260
230 PRINT "MEANINGLESS DIMENSIONS, TRY AGAIN."
240 PRINT
250 GOTO 1950
260 IF H< 27 GOTO 290
270 PRINT " THE WIDTH IS WIDER THEN 80 COLUMNS"
280 GOTO 1950
290 PRINT
300 PRINT
310 LET Q = 0
320 LET Z = 0
330 LET X = INT(RND(1)*H+1)
340 FOR I = 1 TO H
350 IF I = X THEN 380
360 PRINT ":--";
370 GOTO 390
380 PRINT ": ";
390 NEXT I
400 PRINT ":"
410 LET C = 1
420 LET W(X,1) = C
430 LET C = C+1
440 LET R = X
450 LET S = 1
460 GOTO 570
470 IF R <> H THEN 550
480 IF S <> V THEN 520
490 LET R = 1
500 LET S = 1
510 GOTO 560
520 LET R = 1
530 LET S = S+1
540 GOTO 560
550 LET R = R+1
560 IF W(R,S) = 0 THEN 470
570 IF R-1 = 0 THEN 930
580 IF W(R-1,S) <> 0 THEN 930
590 IF S-1 = 0 THEN 740
600 IF W(R,S-1) <> 0 THEN 740
610 IF R = H THEN 650
620 IF W(R+1,S) <> 0 THEN 650
630 LET X = INT(RND(1)*3+1)
640 ON X GOTO 1320,1390,1460
650 IF S <> V THEN 690
660 IF Z = 1 THEN 720
670 LET Q = 1
680 GOTO 700
690 IF W(R,S+1) <> 0 THEN 720
700 LET X = INT(RND(1)*3+1)
710 ON X GOTO 1320,1390,1560
720 LET X = INT(RND(1)*2+1)
730 ON X GOTO 1320,1390
740 IF R = H THEN 850
750 IF W(R+1,S) <> 0 THEN 850
760 IF S<> V THEN 800
770 IF Z = 1 THEN 830
780 LET Q = 1
790 GOTO 810
800 IF W(R,S+1) <> 0 THEN 830
810 LET X = INT(RND(1)*3+1)
820 ON X GOTO 1320,1460,1560
830 LET X = INT(RND(1)*2+1)
840 ON X GOTO 1320,1460
850 IF S <> V THEN 890
860 IF Z = 1 THEN 920
870 LET Q = 1
880 GOT