8-Bit Software Online Conversion
Minesweeper - Listing
10 REM Mine Sweeper
20 REM by Carl Wheat 12/9/93
30 REM For Public Domain
40 :
50 MODE5:VDU19,2,6;0;23;8202;0;0;0;
60 *LOAD SCREEN FFFF5800
70 PROCstart:K$=GET$
80 IF K$="Y" MODE4:PROCinst:MODE5
90 PROCinit
100 IF K%=72 OR K$="H" PROChigh
110 REPEAT:PROCsetup:REPEAT:REPEAT
120 IF P%=0 K%=GET:TIME=0
130 IF P%<>0 K%=INKEY(10) ELSE P%=1
140 PROCclock
150 IF K%=88 OR K%=90 OR K%=58 OR K%=4
7 PROCmove
160 UNTIL K%=77 OR K%=32 OR T%=999
170 IF K%=32 AND D%=0 PROCpress
180 IF K%=77 PROCflag
190 IF T%=999 D%=2
200 IF Z%=0 AND H%<>40 D%=3
210 IF G%=256 AND H%=40 D%=4
220 UNTIL D%<>0:PROCend
230 PROCreplay:UNTIL B%=8
240 MODE7:END
250 :
260 DEFPROCquit
270 I%=B%:B%=8:A%=18:PROCring(1)
280 REPEAT:K%=INKEY(10):PROCclock
290 IF K%=90 PROCring(2):B%=I%:A%=16:U
NTIL A%=16:ENDPROC
300 UNTIL K%=32:D%=5:ENDPROC
310 :
320 DEFPROCreplay
330 VDU4,28,17,31,19,15,12,5
340 PROCbox(1134,452,100,350,1)
350 MOVE 1152,776:PRINT QUIT$
360 PROCbox(1134,60,100,350,1)
370 MOVE 1152,384:PRINT PLAY$
380 B%=1:A%=18:PROCring(1):*FX21,0
390 REPEAT:K%=GET
400 IF K%=58 PROCring(2):B%=8
410 IF K%=47 PROCring(2):B%=1
420 PROCring(1):UNTIL K%=32
430 PROCsquare:ENDPROC
440 :
450 DEFPROCmove
460 PROCring(2):MOVE FNx,FNy+8
470 IF M%(A%,B%)>10 AND M%(A%,B%)<19:G
COL0,1:PRINT;M%(A%,B%)-10
480 IF M%(A%,B%)>18 PRINT F$
490 IF K%=90 A%=A%-1:IF A%<1 A%=1
500 IF K%=88 A%=A%+1:IF A%>16PROCquit
510 IF K%=47 B%=B%-1:IF B%<1 B%=1
520 IF K%=58 B%=B%+1:IF B%>16 B%=16
530 IF D%=0 PROCring(1):*FX21,0
540 ENDPROC
550 :
560 DEFPROCring(C%):GCOL0,C%
570 MOVE FNx,FNy:PRINT R$:ENDPROC
580 :
590 DEFPROCpress
600 IF M%(A%,B%)=0 AND F%=0 PROCfill
610 IF M%(A%,B%)>9 ENDPROC
620 PROCsquare
630 IF M%(A%,B%)=19 PRINT E$:D%=1:ENDP
ROC
640 GCOL0,1:PRINT;M%(A%,B%)-10
650 G%=G%+1:ENDPROC
660 :
670 DEFPROCflag
680 IF M%(A%,B%)>9 ENDPROC
690 PROCsquare:PRINT F$:Z%=Z%-1
700 IF M%(A%,B%)<>19 M%(A%,B%)=20 ELSE
H%=H%+1
710 DEFPROCleft
720 IF Z%DIV10=0 PROCnum(10,1180,200)
ELSE PROCnum(Z%DIV10,1180,200)
730 PROCnum(Z%MOD10,1220,200)
740 G%=G%+1:ENDPROC
750 :
760 DEFPROCfill:I%=A%:J%=B%:F%=1
770 FOR A%=I%-1 TO I%+1
780 FOR B%=J%-1 TO J%+1
790 IF A%>0 AND A%<17 AND B%>0 AND B%<
17 PROCpress
800 NEXT B%,A%
810 A%=I%:B%=J%:F%=0
820 PROCmove:ENDPROC
830 :
840 DEFPROCend
850 VDU4:PRINT P$(D%):VDU5
860 IF D%=4 AND T%<C%(8):PROChigh
870 IF A%=18:PROCsquare
880 FOR B%=1 TO 16:FOR A%=1 TO 16
890 IF M%(A%,B%)=9:PROCsquare:PRINTM$
900 IF M%(A%,B%)=20 MOVE FNx+8,FNy+8:P
RINT X$
910 NEXT A%,B%:ENDPROC
920 :
930 DEFPROChigh
940 IF Q%=1 K%=INKEY(500)
950 GCOL0,130:CLG:N$="":Y%=0
960 IF Q%=0 GOTO 1000
970 FOR X%=1 TO 8
980 IF T%<C%(X%) C%(0)=C%(X%):N$(0)=N$
(X%):C%(X%)=T%:N$(X%)=N$:T%=C%(0):N$=N$(
0):IF Y%=0 Y%=X%
990 NEXT
1000 PROCbox(108,172,1100,740,0)
1010 PROCbox(108,168,1100,740,0)
1020 MOVE 360,980:PRINT"BEST TIMES"
1030 PROCbox(100,164,1100,740,1)
1040 PROCbox(100,160,1100,740,1)
1050 MOVE 352,976:PRINT"BEST TIMES"
1060 FOR X%=1 TO 8:J%=920-80*X%
1070 PROCnum(C%(X%)DIV100,1100,J%)
1080 PROCnum(C%(X%)DIV10MOD10,1140,J%)
1090 PROCnum(C%(X%)MOD10,1180,J%)
1100 MOVE -440,J%-16:PRINT X%
1110 MOVE 300,J%-20:PRINT N$(X%):NEXT
1120 IF Q%=0:MOVE220,100:PRINT"PRESS AN
Y KEY":K%=GET:ENDPROC
1130 VDU19,3,9;0;
1140 PROCbox(260,848-80*Y%,700,84,3)
1150 MOVE180,100:PRINT"ENTER YOUR NAME"
1160 MOVE 300,900-80*Y%:GCOL0,1
1170 K%=0:REPEAT:L%=GET:PRINT CHR$L%;
1180 IF L%=127 K%=K%-1 ELSE K%=K%+1
1190 N$(Y%)=N$(Y%)+CHR$L%
1200 UNTIL L%=13 OR K%>9:VDU19,3,6;0;
1210 MOVE220,100:PRINT"PRESS ANY KEY"
1220 FILE=OPENOUT("SCORES")
1230 FOR X%=1 TO 8
1240 PRINT# FILE,N$(X%),C%(X%)
1250 NEXT:CLOSE# FILE
1260 K%=GET:CLG:VDU19,3,7;0;:ENDPROC
1270 :
1280 DEFPROCsquare:GCOL0,2
1290 MOVE FNx+16,FNy-32:PLOT0,60,0
1300 PLOT81,-60,52:PLOT81,60,0
1310 PROCbox(FNx+12,FNy-32,64,56,0)
1320 IF A%=18 ENDPROC
1330 M%(A%,B%)=M%(A%,B%)+10
1340 MOVE FNx,FNy+8:ENDPROC
1350 :
1360 DEFPROCsetup:T%=18:V%=1:W%=0:Q%=0
1370 Z%=RND(-TIME):Z%=0:TIME=0
1380 GCOL0,130:CLG
1390 VDU28,4,31,18,30
1400 VDU19,0,6;0;19,3,6;0;19,1,0;0;
1410 VDU4:COLOUR 130:CLS
1420 COLOUR 1:PRINT"Please Wait":VDU5
1430 PROCnum(1,1200,88)
1440 FOR Y%=128 TO 968 STEP 56
1450 FOR X%=64 TO 1024 STEP 64
1460 MOVE X%,Y%:PRINT B$
1470 PROCcountdown:NEXT X%,Y%
1480 FOR X%=0 TO 17:FOR Y%=0 TO 17
1490 M%(X%,Y%)=0
1500 PROCcountdown:NEXT Y%,X%
1510 REPEAT:X%=RND(16):Y%=RND(16)
1520 IF M%(X%,Y%)=0M%(X%,Y%)=9:Z%=Z%+1
1530 PROCcountdown:UNTIL Z%=40
1540 FOR X%=1 TO 16:FOR Y%=1 TO 16
1550 IF M%(X%,Y%)<>9 PROCcount
1560 PROCcountdown:NEXT Y%,X%
1570 VDU19,0,0;0;19,3,7;0;19,1,1;0;
1580 PROCnum(10,1240,88):VDU4,12,5
1590 REPEAT:A%=RND(16):B%=RND(16)
1600 UNTIL M%(A%,B%)=0:PROCring(1)
1610 PROCbox(1110,890,140,80,1)
1620 VDU23,140,251,33,33,33,33,33,35,0
1630 VDU23,141,162,54,42,34,34,34,162,0
1640 VDU23,142,240,128,128,192,128,128,
240,0
1650 MOVE1104,868
1660 PRINT CHR$140+CHR$141+CHR$142
1670 PROCbox(1110,130,140,80,1)
1680 VDU23,140,244,132,132,228,132,132,
135,0
1690 VDU23,141,49,74,74,122,74,74,73,0
1700 VDU23,142,136,84,16,200,68,84,136,
0
1710 MOVE 1100,100
1720 PRINT CHR$140+CHR$141+CHR$142
1730 PROCbox(1134,452,100,350,1)
1740 MOVE 1152,776:PRINT QUIT$
1750 D%=0:G%=-1:H%=0:P%=0:Q%=1
1760 PROCleft:*FX21,0
1770 T%=0:V%=0:W%=0:ENDPROC
1780 :
1790 DEFPROCbox(X%,Y%,L%,H%,V%)
1800 GCOL0,V%:PLOT4,X%,Y%
1810 PLOT1,L%,0:PLOT1,0,H%
1820 PLOT1,-L%,0:PLOT1,0,-H%
1830 ENDPROC
1840 :
1850 DEFPROCcount:N%=0
1860 FOR J%=Y%-1 TO Y%+1
1870 FOR I%=X%-1 TO X%+1
1880 IF M%(I%,J%)=9 N%=N%+1
1890 NEXT I%,J%
1900 M%(X%,Y%)=N%:ENDPROC
1910 :
1920 DEFFNx=A%*64-16
1930 DEFFNy=B%*56+52
1940 :
1950 DEFPROCinit
1960 VDU19,2,6;0;5,23;8202;0;0;0;
1970 DIM M%(17,17),A$(10),P$(5):F%=0
1980 VDU23,48,0,0,0,0,0,0,0,0
1990 VDU23,49,0,2,6,2,2,2,2,7
2000 VDU23,50,0,6,9,9,1,2,4,15
2010 VDU23,51,0,6,9,1,6,1,9,6
2020 VDU23,52,0,16,16,18,18,31,2,2
2030 VDU23,53,0,14,8,14,1,1,9,6
2040 VDU23,54,0,6,8,8,14,9,9,6
2050 VDU23,55,0,15,1,1,2,2,4,4
2060 VDU23,56,0,6,9,9,6,9,9,6
2070 VDU23,129,0,0,15,15,0,0,0,0
2080 VDU23,130,0,0,0,0,0,0,0,6
2090 VDU23,131,0,0,1,1,1,1,1,1
2100 VDU23,132,0,0,8,8,8,8,8,8
2110 VDU23,133,8,8,8,8,8,8,0,0
2120 VDU23,134,1,1,1,1,1,1,0,0
2130 VDU23,135,0,0,0,0,15,15,0,0
2140 VDU23,136,6,0,0,0,0,0,0,0
2150 VDU23,137,15,15,15,15,15,15,15,15
2160 VDU23,138,0,1,3,3,3,3,3,3
2170 VDU23,139,3,3,3,63,127,255,0,0
2180 VDU23,143,0,65,34,20,8,20,34,65
2190 VDU23,249,4,21,14,14,21,4,0,0
2200VDU23,250,255,254,252,192,192,192,1
92,192,23,251,192,192,192,192,128,0,0,0
2210 VDU23,252,6,9,9,9,6,0,0,0
2220 VDU23,253,4,4,4,4,4,4,14,14
2230 VDU23,254,0,2,3,2,0,0,0,0
2240 VDU23,255,0,0,0,4,21,14,31,31
2250 R$=CHR$252:D$=CHR$10:L$=CHR$8
2260 F$=CHR$18+CHR$0+CHR$0+CHR$253+CHR$
8+CHR$18+CHR$0+CHR$1+CHR$254
2270 E$=CHR$18+CHR$0+CHR$0+CHR$255+CHR$
8+CHR$18+CHR$0+CHR$1+CHR$249
2280 M$=CHR$18+CHR$0+CHR$0+CHR$255
2290 X$=CHR$18+CHR$0+CHR$1+CHR$143
2300 B$=CHR$18+CHR$0+CHR$3+CHR$250+L$+C
HR$10+CHR$251+CHR$18+CHR$0+CHR$0+L$+CHR$
139+L$+CHR$11+CHR$138
2310 QUIT$="Q"+L$+D$+D$+"U"+L$+D$+D$+"I
"+L$+D$+D$+"T"+L$+D$+D$+B$
2320 PLAY$="P"+L$+D$+D$+"L"+L$+D$+D$+"A
"+L$+D$+D$+"Y"+L$+D$+D$+B$
2330 RT$=L$+CHR$131:LT$=L$+CHR$132
2340 LB$=L$+CHR$133:RB$=L$+CHR$134
2350 TT$=L$+CHR$129:BB$=L$+CHR$135
2360 MM$=L$+CHR$130+D$+L$+CHR$136
2370 P$(1)="You are Dead"
2380 P$(2)="Out of Time"
2390 P$(3)="Out of Flags"
2400 P$(4)=" Well Done"
2410 P$(5)=" You Quit"
2420 A$(0)=TT$+LT$+RT$+D$+LB$+RB$+BB$
2430 A$(1)=RT$+D$+RB$
2440 A$(2)=TT$+RT$+MM$+LB$+BB$
2450 A$(3)=TT$+RT$+MM$+RB$+BB$
2460 A$(4)=LT$+RT$+MM$+RB$
2470 A$(5)=TT$+LT$+MM$+RB$+BB$
2480 A$(6)=TT$+LT$+MM$+LB$+RB$+BB$
2490 A$(7)=TT$+RT$+D$+RB$
2500 A$(8)=TT$+RT$+LT$+MM$+RB$+BB$+LB$
2510 A$(9)=TT$+LT$+RT$+MM$+RB$
2520 A$(10)=L$+CHR$137+D$+L$+CHR$137+CH
R$11:ENDPROC
2530 :
2540 DEFPROCclock
2550 IF T%=TIME DIV100 ENDPROC
2560 T%=TIME DIV100
2570 IF W%<>T%DIV100 W%=T%DIV100:PROCnu
m(W%,1160,960)
2580 IF V%<>(T%DIV10)MOD10 V%=(T%DIV10)
MOD10:PROCnum(V%,1200,960)
2590 PROCnum(T%MOD10,1240,960):ENDPROC
2600 :
2610 DEFPROCcountdown
2620 IF W%=T%-(TIME)DIV100 ENDPROC
2630 W%=T%-(TIME)DIV100
2640 PROCnum(W%MOD10,1240,88)
2650 IF V%=10 OR (W%DIV10)MOD10=1 ENDPR
OC
2660 V%=10:PROCnum(V%,1200,88):ENDPROC
2670 :
2680 DEFPROCnum(N%,I%,J%)
2690 MOVE I%,J%:GCOL0,2:PRINT A$(10);
2700 IF N%=10 ENDPROC
2710 IF Q%=0 GCOL0,1 ELSE GCOL0,0
2720 PRINT A$(N%):ENDPROC
2730 :
2740 DEFPROCstart:DIM N$(8),C%(8):Q%=0
2750 FILE=OPENIN("SCORES")
2760 FOR X%=1 TO 8
2770 INPUT# FILE,N$(X%),C%(X%)
2780 NEXT:CLOSE# FILE
2790 ENDPROC
2800 :
2810 DEFPROCinst:VDU23;8202;0;0;0;
2820 VDU19,0,6;0;19,1,0;0;
2830 PRINT'SPC(14)"INSTRUCTIONS"
2840 PRINTSPC(14)"````````````"
2850 PRINT'" You are the Captain of a M
ine-sweeping"'" vessel, and your mission
is to quickly"'" clear an active mine f
ield."
2860 PRINT'" There are 40 mines hidden
in the area, and you have 40 flags to
mark these mines in the field with."
2870 PRINT'" Use these keys to move the
red circle."
2880 PRINT'SPC(8)"Z - LEFT"SPC(7)"X - R
IGHT"'SPC(8)": - UP"SPC(9)"/ - DOWN"
2890 PRINT'SPC(4)"press SPACE - to clea
r a square"
2900 PRINT'SPC(4)"press M - to mark a m
ined square"
2910 PRINT'" The number on a cleared s
quare shows"'" the number of mines that
are next to"'" that square, including
diagonally."
2920 PRINT" There are no mines next t
o cleared"'" squares that are blank."'
" Attempt to clear a mined square and"
'" you will be blown up."
2930 PRINT'SPC(3)"=> PRESS H TO SEE HI
GH SCORES <="
2940 PRINTSPC(3)"==> OR ANY KEY TO
PLAY. <==":K%=GET:ENDPROC