You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
140 lines
3.0 KiB
QBasic
140 lines
3.0 KiB
QBasic
8 years ago
|
#lang basic-demo
|
||
9 years ago
|
|
||
|
10 PRINT TAB(28);"AMAZING PROGRAM"
|
||
|
20 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
|
||
|
30 PRINT:PRINT:PRINT:PRINT
|
||
9 years ago
|
100 INPUT "WHAT ARE YOUR WIDTH AND LENGTH";HMAX,VMAX
|
||
|
102 IF HMAX<>1 AND VMAX<>1 THEN 110
|
||
|
104 PRINT "MEANINGLESS DIMENSIONS. TRY AGAIN.":GOTO 100
|
||
|
110 DIM W(HMAX,VMAX),V(HMAX,VMAX)
|
||
9 years ago
|
120 PRINT
|
||
|
130 PRINT
|
||
|
140 PRINT
|
||
|
150 PRINT
|
||
9 years ago
|
160 Q=0:Z=0:X=INT(RND(1)*HMAX+1)
|
||
|
165 FOR I=1 TO HMAX
|
||
9 years ago
|
170 IF I=X THEN 173
|
||
9 years ago
|
171 PRINT "+--";:GOTO 180
|
||
|
173 PRINT "+ ";
|
||
9 years ago
|
180 NEXT I
|
||
9 years ago
|
190 PRINT "+"
|
||
9 years ago
|
195 C=1:W(X,1)=C:C=C+1
|
||
|
200 R=X:S=1:GOTO 260
|
||
9 years ago
|
210 IF R<>HMAX THEN 240
|
||
|
215 IF S<>VMAX THEN 230
|
||
9 years ago
|
220 R=1:S=1:GOTO 250
|
||
|
230 R=1:S=S+1:GOTO 250
|
||
|
240 R=R+1
|
||
|
250 IF W(R,S)=0 THEN 210
|
||
|
260 IF R-1=0 THEN 530
|
||
|
265 IF W(R-1,S)<>0 THEN 530
|
||
|
270 IF S-1=0 THEN 390
|
||
|
280 IF W(R,S-1)<>0 THEN 390
|
||
9 years ago
|
290 IF R=HMAX THEN 330
|
||
9 years ago
|
300 IF W(R+1,S)<>0 THEN 330
|
||
9 years ago
|
310 X=INT(RND(1)*3+1)
|
||
9 years ago
|
320 ON X GOTO 790,820,860
|
||
9 years ago
|
330 IF S<>HMAX THEN 340
|
||
9 years ago
|
334 IF Z=1 THEN 370
|
||
|
338 Q=1:GOTO 350
|
||
|
340 IF W(R,S+1)<>0 THEN 370
|
||
9 years ago
|
350 X=INT(RND(1)*3+1)
|
||
9 years ago
|
360 ON X GOTO 790,820,910
|
||
9 years ago
|
370 X=INT(RND(1)*2+1)
|
||
9 years ago
|
380 ON X GOTO 790,820
|
||
9 years ago
|
390 IF R=HMAX THEN 470
|
||
9 years ago
|
400 IF W(R+1,S)<>0 THEN 470
|
||
9 years ago
|
405 IF S<>VMAX THEN 420
|
||
9 years ago
|
410 IF Z=1 THEN 450
|
||
|
415 Q=1:GOTO 430
|
||
9 years ago
|
420 IF W(R,S+1)<>0 THEN 450
|
||
|
430 X=INT(RND(1)*3+1)
|
||
9 years ago
|
440 ON X GOTO 790,860,910
|
||
9 years ago
|
450 X=INT(RND(1)*2+1)
|
||
9 years ago
|
460 ON X GOTO 790,860
|
||
9 years ago
|
470 IF S<>VMAX THEN 490
|
||
9 years ago
|
480 IF Z=1 THEN 520
|
||
|
485 Q=1:GOTO 500
|
||
9 years ago
|
490 IF W(R,S+1)<>0 THEN 520
|
||
|
500 X=INT(RND(1)*2+1)
|
||
9 years ago
|
510 ON X GOTO 790,910
|
||
|
520 GOTO 790
|
||
|
530 IF S-1=0 THEN 670
|
||
|
540 IF W(R,S-1)<>0 THEN 670
|
||
9 years ago
|
545 IF R=HMAX THEN 610
|
||
9 years ago
|
547 IF W(R+1,S)<>0 THEN 610
|
||
9 years ago
|
550 IF S<>VMAX THEN 560
|
||
9 years ago
|
552 IF Z=1 THEN 590
|
||
|
554 Q=1:GOTO 570
|
||
|
560 IF W(R,S+1)<>0 THEN 590
|
||
9 years ago
|
570 X=INT(RND(1)*3+1)
|
||
9 years ago
|
580 ON X GOTO 820,860,910
|
||
9 years ago
|
590 X=INT(RND(1)*2+1)
|
||
9 years ago
|
600 ON X GOTO 820,860
|
||
9 years ago
|
610 IF S<>VMAX THEN 630
|
||
9 years ago
|
620 IF Z=1 THEN 660
|
||
|
625 Q=1:GOTO 640
|
||
|
630 IF W(R,S+1)<>0 THEN 660
|
||
9 years ago
|
640 X=INT(RND(1)*2+1)
|
||
9 years ago
|
650 ON X GOTO 820,910
|
||
|
660 GOTO 820
|
||
9 years ago
|
670 IF R=HMAX THEN 740
|
||
9 years ago
|
680 IF W(R+1,S)<>0 THEN 740
|
||
9 years ago
|
685 IF S<>VMAX THEN 700
|
||
9 years ago
|
690 IF Z=1 THEN 730
|
||
|
695 Q=1:GOTO 830
|
||
|
700 IF W(R,S+1)<>0 THEN 730
|
||
9 years ago
|
710 X=INT(RND(1)*2+1)
|
||
9 years ago
|
720 ON X GOTO 860,910
|
||
|
730 GOTO 860
|
||
9 years ago
|
740 IF S<>VMAX THEN 760
|
||
9 years ago
|
750 IF Z=1 THEN 780
|
||
|
755 Q=1:GOTO 770
|
||
|
760 IF W(R,S+1)<>0 THEN 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
|
||
9 years ago
|
810 IF C=HMAX*VMAX+1 THEN 1010
|
||
9 years ago
|
815 Q=0:GOTO 260
|
||
|
820 W(R,S-1)=C
|
||
|
830 C=C+1
|
||
9 years ago
|
840 V(R,S-1)=1:S=S-1:IF C=HMAX*VMAX+1 THEN 1010
|
||
9 years ago
|
850 Q=0:GOTO 260
|
||
|
860 W(R+1,S)=C
|
||
|
870 C=C+1:IF V(R,S)=0 THEN 880
|
||
|
875 V(R,S)=3:GOTO 890
|
||
|
880 V(R,S)=2
|
||
|
890 R=R+1
|
||
9 years ago
|
900 IF C=HMAX*VMAX+1 THEN 1010
|
||
9 years ago
|
905 GOTO 530
|
||
|
910 IF Q=1 THEN 960
|
||
|
920 W(R,S+1)=C:C=C+1:IF V(R,S)=0 THEN 940
|
||
|
930 V(R,S)=3:GOTO 950
|
||
|
940 V(R,S)=1
|
||
9 years ago
|
950 S=S+1:IF C=HMAX*VMAX+1 THEN 1010
|
||
9 years ago
|
955 GOTO 260
|
||
|
960 Z=1
|
||
|
970 IF V(R,S)=0 THEN 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
|
||
9 years ago
|
1010 FOR J=1 TO VMAX
|
||
|
1011 PRINT "|";
|
||
|
1012 FOR I=1 TO HMAX
|
||
9 years ago
|
1013 IF V(I,J)<2 THEN 1030
|
||
|
1020 PRINT " ";
|
||
|
1021 GOTO 1040
|
||
9 years ago
|
1030 PRINT " |";
|
||
9 years ago
|
1040 NEXT I
|
||
|
1041 PRINT
|
||
9 years ago
|
1043 FOR I=1 TO HMAX
|
||
9 years ago
|
1045 IF V(I,J)=0 THEN 1060
|
||
|
1050 IF V(I,J)=2 THEN 1060
|
||
9 years ago
|
1051 PRINT "+ ";
|
||
9 years ago
|
1052 GOTO 1070
|
||
9 years ago
|
1060 PRINT "+--";
|
||
9 years ago
|
1070 NEXT I
|
||
9 years ago
|
1071 PRINT "+"
|
||
9 years ago
|
1072 NEXT J
|
||
|
1073 END
|