10 WIDTH 80:PRINT CHR$(26)
20 PRINT TAB(28);"AMAZINGP PROGRAM"
30 PRINT:PRINT
40 PRINT TAB(15);"CREATIVE COMPUTING  MORRISTOWN, NEW JERSEY"
50 PRINT:PRINT:PRINT
60 PRINT "   THIS PROGRAM GENERATES MAZES OF DIMENSIONS YOU SPECIFY."
70 PRINT "EVERY MAZE IS DIFFERENT, AND HAS ONLY ONE WAY THROUGH. THE"
80 PRINT "MAZE APPEARS ON THE PRINTER. IF YOU WANT THE MAZE ON THE"
90 PRINT 

   "CRT SCREEN, RUN THE 'AMAZING' PROGRAM INSTEAD OF THIS ONE.":PRINT:PRINT
100 INPUT 

    "WHAT ARE YOUR WIDTH AND LENGTH (TWO NUMBERS SEPARATED BY A COMMA)";H,V
110 IF H>26 THEN PRINT:PRINT "TOO WIDE FOR 8 INCH PAPER. DO YOU HAVE 15 INCH":

    INPUT "PAPER IN THE PRINTER (Y OR N)";PP$ ELSE GOTO 120
112 IF LEFT$(PP$,1)="N" OR LEFT$(PP$,1)="n" THEN PRINT:GOTO 100
120 IF H<>1 AND V<>1 THEN 140
130 PRINT:PRINT "MEANINGLESS DIMENSIONS.  TRY AGAIN.":PRINT:PRINT:GOTO 100
140 DIM W(H,V),V(H,V)
145 PRINT:LINE INPUT "HIT 'RETURN' WHEN PAPER IS POSITIONED: ";QQ$
146 PRINT:PRINT:PRINT "---   Printing   ---":PRINT:PRINT
150 LPRINT
160 LPRINT
170 LPRINT
180 LPRINT
190 Q=0:Z=0:X=INT(RND(1)*H+1)
200 FOR I=1 TO H
210 IF I=X THEN 230
220 LPRINT ".--";:GOTO 240
230 LPRINT ".  ";
240 NEXT I
250 LPRINT "."
260 C=1:W(X,1)=C:C=C+1
270 R=X:S=1:GOTO 340
280 IF R<>H THEN 320
290 IF S<>V THEN 310
300 R=1:S=1:GOTO 330
310 R=1:S=S+1:GOTO 330
320 R=R+1
330 IF W(R,S)=0 THEN 280
340 IF R-1=0 THEN 670
350 IF W(R-1,S)<>0 THEN 670
360 IF S-1=0 THEN 500
370 IF W(R,S-1)<>0 THEN 500
380 IF R=H THEN 420
390 IF W(R+1,S)<>0 THEN 420
400 X=INT(RND(1)*3+1)
410 ON X GOTO 1010,1050,1090
420 IF S<>V THEN 450
430 IF Z=1 THEN 480
440 Q=1:GOTO 460
450 IF W(R,S+1)<>0 THEN 480
460 X=INT(RND(1)*3+1)
470 ON X GOTO 1010,1050,1160
480 X=INT(RND(1)*2+1)
490 ON X GOTO 1010,1050
500 IF R=H THEN 600
510 IF W(R+1,S)<>0 THEN 600
520 IF S<>V THEN 550
530 IF Z=1 THEN 580
540 Q=1:GOTO 560
550 IF W(R,S+1)<>0 THEN 580
560 X=INT(RND(1)*3+1)
570 ON X GOTO 1010,1090,1160
580 X=INT(RND(1)*2+1)
590 ON X GOTO 1010,1090
600 IF S<>V THEN 630
610 IF Z=1 THEN 660
620 Q=1:GOTO 640
630 IF W(R,S+1)<>0 THEN 660
640 X=INT(RND(1)*2+1)
650 ON X GOTO 1010,1160
660 GOTO 1010
670 IF S-1=0 THEN 860
680 IF W(R,S-1)<>0 THEN 860
690 IF R=H THEN 790
700 IF W(R+1,S)<>0 THEN 790
710 IF S<>V THEN 740
720 IF Z=1 THEN 770
730 Q=1:GOTO 750
740 IF W(R,S+1)<>0 THEN 770
750 X=INT(RND(1)*3+1)
760 ON X GOTO 1050,1090,1160
770 X=INT(RND(1)*2+1)
780 ON X GOTO 1050,1090
790 IF S<>V THEN 820
800 IF Z=1 THEN 850
810 Q=1:GOTO 830
820 IF W(R,S+1)<>0 THEN 850
830 X=INT(RND(1)*2+1)
840 ON X GOTO 1050,1160
850 GOTO 1050
860 IF R=H THEN 950
870 IF W(R+1,S)<>0 THEN 950
880 IF S<>V THEN 910
890 IF Z=1 THEN 940
900 Q=1:GOTO 1060
910 IF W(R,S+1)<>0 THEN 940
920 X=INT(RND(1)*2+1)
930 ON X GOTO 1090,1160
940 GOTO 1090
950 IF S<>V THEN 980
960 IF Z=1 THEN 1000
970 Q=1:GOTO 990
980 IF W(R,S+1)<>0 THEN 1000
990 GOTO 1160
1000 GOTO 1260
1010 W(R-1,S)=C
1020 C=C+1:V(R-1,S)=2:R=R-1
1030 IF C=H*V+1 THEN 1270
1040 Q=0:GOTO 340
1050 W(R,S-1)=C
1060 C=C+1
1070 V(R,S-1)=1:S=S-1:IF C=H*V+1 THEN 1270
1080 Q=0:GOTO 340
1090 W(R+1,S)=C
1100 C=C+1:IF V(R,S)=0 THEN 1120
1110 V(R,S)=3:GOTO 1130
1120 V(R,S)=2
1130 R=R+1
1140 IF C=H*V+1 THEN 1270
1150 GOTO 670
1160 IF Q=1 THEN 1220
1170 W(R,S+1)=C:C=C+1:IF V(R,S)=0 THEN 1190
1180 V(R,S)=3:GOTO 1200
1190 V(R,S)=1
1200 S=S+1:IF C=H*V+1 THEN 1270
1210 GOTO 340
1220 Z=1
1230 IF V(R,S)=0 THEN 1250
1240 V(R,S)=3:Q=0:GOTO 1260
1250 V(R,S)=1:Q=0:R=1:S=1:GOTO 330
1260 GOTO 280
1270 FOR J=1 TO V
1280 LPRINT "I";
1290 FOR I=1 TO H
1300 IF V(I,J)<2 THEN 1330
1310 LPRINT "   ";
1320 GOTO 1340
1330 LPRINT "  I";
1340 NEXT I
1350 LPRINT
1360 FOR I=1 TO H
1370 IF V(I,J)=0 THEN 1410
1380 IF V(I,J)=2 THEN 1410
1390 LPRINT ":  ";
1400 GOTO 1420
1410 LPRINT ":--";
1420 NEXT I
1430 LPRINT "."
1440 NEXT J
1445 LPRINT CHR$(12)
1450 RUN "MENU"
