-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMINEFIELD.BAS
126 lines (126 loc) · 4.74 KB
/
MINEFIELD.BAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
10 CLS
20 MODE 9
30 PROCsetup
35 PROCvdu
40 PROCshadow("MINEFIELD",1,3,5,24)
50 PROCshadow("I=instructions",4,7,2,19):PROCshadow("S=start game",4,7,2,17)
60 REPEAT:
70 keyhit=GET:IF keyhit=73 THEN MODE9:PROCvdu:PROCintro:MODE9:PROCvdu:PROCintro2:CLS:GOTO35
80 UNTIL keyhit=83
90 REM
100 MODE 9
110 PROCvdu
120 PROCscreen
130 PROCminefield
140 PROCplay
150 IFMF%(MX%+DX%,MY%+DY%)=1THEN140
160 PRINTTAB(MX%,MY%+6)" "
170 MX%=MX%+DX%:MY%=MY%+DY%
180 IFMF%(MX%,MY%)=2THENSOUND0,-6,10,10:PRINTTAB(1,3)" You hit a mine !";TAB(6,5)"***":COLOUR1:PRINTTAB(MX%,MY%+6);CHR$231:MF%(MX%,MY%)=0:S%=0:GOTO250
190 IFMF%(MX%,MY%)=4 AND flags = 0THEN :T%=T%-INT(TIME/100):S%=S%+T%:PRINTTAB(1,2)" You made it ! ";:FORN%=120TO200STEP10:SOUND1,-15,N%,2:NEXT:SOUND1,-15,200,6:PRINTTAB(MX%+1,MY%+6);CHR$233:GOTO250
200 IF MF%(MX%,MY%)=6 THEN MF%(MX%,MY%)=0:flags=flags-1:SOUND1,-12,100,2:S%=S%+10
210 PRINTTAB(MX%,MY%+6);CHR$226
220 GOTO140
250 COLOUR5
260 IFS%<0THENS%=0
270 FORA%=1TO18
280 FORB%=1TO21
290 IFMF%(A%,B%)=2THENPRINTTAB(A%,B%+6);CHR$(224)
300 NEXT
310 NEXT
320 COLOUR5:PRINTTAB(1,2);"Another game ?? ";
330 inkey=GET
340 IFinkey=78 THEN END ELSE COLOUR7
350 PRINTTAB(1,31);STRING$(16,CHR$(32));:GOTO130:PRINTTAB(0,0);
380 DEFPROCsetup
390 VDU23,224,0,60,90,102,102,90,60,0
400 VDU23,225,255,213,171,213,171,213,171,255
410 VDU23,226,28,28,8,62,73,85,20,54
420 VDU23,227,96,88,70,88,96,64,64,64
430 VDU23,228,16,4,128,106,1,32,8,129
440 VDU23,229,73,8,106,1,36,128,98,4
450 VDU23,230,128,68,136,80,2,107,32,128
460 VDU23,231,0,136,136,232,235,63,63,0
470 VDU23,232,16,56,56,124,124,254,16,16
480 VDU23,233,28,93,73,127,8,20,34,65
490 DIMMF%(19,22)
500 H%=0
510 ENDPROC
530 DEFPROCintro
540 PRINT''''"Your task is to cross a minefield without getting yourself killed! In this game you only get ONE life!"
550 PRINT''"To help you in this task you carry an automatic mine detector. This gives a continuously updated read out at the topof the screen. This will tell you how many mines there are in the eight squares around you.":
560 COLOUR1:PRINT''''"Any key to continue":A$=GET$:COLOUR7
570 ENDPROC
590 DEFPROCintro2
600 PRINT''"THE CONTROLS:"
610 PRINT'" UP W"
620 PRINT" DOWN S"
630 PRINT" LEFT A"
640 PRINT" RIGHT D"
650 PRINT''''"THE SCREEN:"
660 PRINT'" You= ";CHR$226
670 PRINT" Tree= ";:COLOUR2:PRINT;CHR$232:COLOUR7
680 PRINT" Mystery= ";:COLOUR2:PRINT CHR$228:COLOUR7
690 PRINT"Boundary= ";:COLOUR1:PRINT;CHR$225:COLOUR7
700 PRINT" Start= S"
710 PRINT" Finish= ";:COLOUR11:PRINT"F"
720 COLOUR1:PRINT''"Any key to continue":COLOUR7:A$=GET$
730 ENDPROC
750 DEFPROCscreen
760 PROCshadow("MINEFIELD",1,3,5,31)
770 COLOUR2:PRINTTAB(0,5)"SCORE";TAB(10,5)"BONUS"
780 COLOUR1:PRINTTAB(1,6);STRING$(18,CHR$(225));TAB(1,28);STRING$(18,CHR$(225))
790 FORN%=6TO28:PRINTTAB(0,N%);CHR$(225):PRINTTAB(19,N%);CHR$(225):NEXT
800 S%=0
810 ENDPROC
830 DEFPROCminefield
840 MX%=1:MY%=11:DX%=0:DY%=0:flags=0:S%=0
850 COLOUR3:PRINTTAB(0,17);"S":COLOUR 11:PRINTTAB(19,17);"F"
860 COLOUR2:PRINTTAB(1,2)" Flags to collect"
870 PRINTTAB(1,3)" Mines around you"
880 COLOUR11:PRINTTAB(4,17)"PLEASE WAIT"
890 FORA%=1TO18
900 FORB%=1TO21
910 IFRND(6)>1THENMF%(A%,B%)=0:GOTO950
920 IFRND(4)=1THENMF%(A%,B%)=1:GOTO950
930 IFRND(4)=1THENMF%(A%,B%)=6:GOTO950
940 MF%(A%,B%)=2
950 NEXT
960 NEXT
970 MF%(18,11)=4
980 MF%(1,10)=0:MF%(1,12)=0:MF%(2,11)=0:MF%(1,11)=0:MF%(17,11)=0
990 FORA%=1TO18
1000 FORB%=1TO21
1010 IFMF%(A%,B%)=0 ORMF%(A%,B%)=2 THEN COLOUR2:PRINTTAB(A%,B%+6);CHR$(227+RND(3))
1020 IFMF%(A%,B%)=1 THENCOLOUR2:PRINTTAB(A%,B%+6);CHR$232
1030 IFMF%(A%,B%)=6 THEN COLOUR6:PRINTTAB(A%,B%+6);CHR$(227):flags=flags+1
1040 NEXT
1050 NEXT
1060 COLOUR2:PRINTTAB(18,17)CHR$228
1070 COLOUR7:PRINTTAB(1,17);CHR$226:TIME=0
1080 T%=600:PRINTTAB(16,5);T%
1090 ENDPROC
1110 DEFPROCplay
1120 PRINTTAB(1,2);" ";TAB(1,2);flags;TAB(6,5)S%
1130 PRINTTAB(16,5);" ";TAB(16,5);T%-INT(TIME/100)
1140 NM%=0
1150 FORA%=-1TO1
1160 FORB%=-1TO1
1170 IFMF%(MX%+A%,MY%+B%)=2THEN NM%=NM%+1
1180 NEXT
1190 NEXT
1200 PRINTTAB(1,3);NM%
1210 REM
1220 A$=GET$:DX%=0:DY%=0
1230 DX%=(A$="A")*1+(A$="D")*-1
1240 DY%=(A$="W")*1+(A$="S")*-1
1250 IF(MX%=1ANDDX%=-1)OR(MX%=18ANDDX%=1)THENDX%=0
1260 IF(MY%=1ANDDY%=-1)OR(MY%=21ANDDY%=1)THENDY%=0
1270 ENDPROC
1290 DEFPROCshadow(T$,C1,C2,H,V)
1300 VDU5
1310 GCOL0,C1:MOVE64*H,32*V:PRINT T$
1320 GCOL0,C2:MOVE H*64-8,V*32+4:PRINT T$
1330 VDU4
1340 ENDPROC
1350 DEFPROCvdu:VDU23;8202;0;0;0;:ENDPROC