-
Notifications
You must be signed in to change notification settings - Fork 0
/
bull2.bas
139 lines (139 loc) · 3.87 KB
/
bull2.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
127
128
129
130
131
132
133
134
135
136
137
138
139
10REM Beat the Bull!
20REM (C) Burchellsoft 1986
30MODE2
40VDU23;8202;0;0;0;
50ONERROR IF ERR=17 RUN ELSE REPORT:PRINT" at line ";ERL:END
60DIM HX%(3),HY%(3)
70REPEAT
80C$=CHR$17+CHR$6+CHR$225+" "+CHR$17+CHR$1+CHR$224+" "
90PROCTITLE
100LEV%=1:L%=3
110REPEAT
120PROCINIT
130PROCSCREEN
140REPEAT
150PROCMAN
160PROCBULL
170UNTILH%=TRUE OR MI%=TRUE
180UNTILL%=0 OR F%=TRUE
190IF F%=TRUE GOTO 200 ELSE FORY%=0TO31:SOUND1,-12,(Y%*-4)-130,1:PRINTTAB(0,Y%);SPC(20):NEXT
200UNTILFALSE
210END
220DEFPROCTITLE
230CLS
240COLOUR7:PRINTTAB(3,10);"BEAT THE BULL"
250REPEAT:PRINTTAB(8,20);C$
260UNTILINKEY(-99)
270ENDPROC
280DEFPROCINIT
290MX%=5:MY%=18
300BX%=18:BY%=2
310H%=FALSE:MI%=FALSE:F%=FALSE
320G$=CHR$17+CHR$7+CHR$229+CHR$17+CHR$2
330M$=CHR$17+CHR$6+CHR$225
340B$=CHR$17+CHR$1+CHR$224
350H$=CHR$17+CHR$2+CHR$226
360ENDPROC
370DEFPROCSCREEN
380CLS
390COLOUR2:PRINTTAB(1,1);CHR$228;G$;STRING$(16,CHR$226);CHR$227
400FORP%=2TO18:PRINTTAB(1,P%);CHR$228;SPC(17);CHR$227
410NEXT
420COLOUR2:PRINTTAB(1,19);CHR$228;STRING$(3,CHR$226);G$;STRING$(13,CHR$226);CHR$227
430PROCHEDGE
440COLOUR7:PRINTTAB(7,23);"Field ";LEV%
450PRINTTAB(MX%,MY%);M$
460PRINTTAB(BX%,BY%);B$
470PROCLIVES
480TIME=0:REPEATUNTILTIME>100
490ENDPROC
500DEFPROCMAN
510IFINKEY(-98)ANDFNR(MX%-1,MY%)=32 MX%=MX%-1:PROCPM:PROCDM(MX%+1,MY%):ENDPROC
520IFINKEY(-67)ANDFNR(MX%+1,MY%)=32 MX%=MX%+1:PROCPM:PROCDM(MX%-1,MY%):ENDPROC
530IFINKEY(-73)ANDFNR(MX%,MY%-1)=32 MY%=MY%-1:PROCPM:PROCDM(MX%,MY%+1):ENDPROC
540IFINKEY(-73)ANDFNR(MX%,MY%-1)=133 PROCMADEIT:ENDPROC
550IFINKEY(-105)ANDFNR(MX%,MY%+1)=32 MY%=MY%+1:PROCPM:PROCDM(MX%,MY%-1):ENDPROC
560ENDPROC
570DEFPROCPM:SOUND1,-12,1,1:PRINTTAB(MX%,MY%);M$:ENDPROC
580DEFPROCDM(P%,Q%):VDU31,P%,Q%,32:ENDPROC
590DEFFNR(P%,Q%)
600LX%=POS:LY%=POS
610VDU31,P%,Q%
620A%=135
630C%=USR(&FFF4)
640C%=C% AND &FFFF
650C%=C% DIV &100
660VDU31,LX%,LY%
670=C%
680DEFPROCBULL
690IF MI%=TRUE OR H%=TRUE ENDPROC
700OBX%=BX%:OBY%=BY%
710IFBX%>MX% BX%=BX%-1
720IFBX%<MX% BX%=BX%+1
730IFBY%>MY% BY%=BY%-1
740IFBY%<MY% BY%=BY%+1
750IFBY%=MY% AND BX%=MX% PROCBASH
760IFFNR(BX%,BY%)<>32 BX%=OBX%:BY%=OBY%:ENDPROC
770PROCDM(OBX%,OBY%)
780PRINTTAB(BX%,BY%);B$
790ENDPROC
800DEFPROCBASH
810H%=TRUE
820RESTORE
830IFMX%>=10W%=-1 ELSE W%=1
840FORS%=-15TO-12:SOUND1,S%,1,1:NEXT
850PRINTTAB(MX%,MY%);" "
860FORM%=1 TO9
870READ M1%,M2%:M1%=M1%*W%
880SOUND1,-12,(MY%*-4)+100,1
890IFFNR(MX%+M1%,MY%+M2%)<>32 GOTO940
900MX%=MX%+M1%:MY%=MY%+M2%
910PRINTTAB(MX%,MY%);M$
920TIME=0:REPEATUNTILTIME>10
930PRINTTAB(MX%,MY%);" "
940NEXT
950DATA 1,-1,1,-1,1,-1,1,0,1,0,1,0,1,1,1,1,1,1
960L%=L%-1:PROCLIVES
970ENDPROC
980DEFPROCMADEIT
990VDU19,7,15,0,0,0
1000MI%=TRUE:LEV%=LEV%+1
1010FORD%=1TO4:FORV%=-15 TO-4:SOUND1,V%,150,1:NEXT,
1020VDU19,7,7,0,0,0
1030IF LEV%=11 F%=TRUE:PROCDONEIT
1040ENDPROC
1050DEFPROCLIVES
1060COLOUR6:L$=STRING$(L%,CHR$225):PRINTTAB(1,24);L$
1070ENDPROC
1080DEFPROCHEDGE
1090ON LEV% GOSUB1120,1130,1140,1150,1160,1170,1180,1190,1200,1210
1100FORHE%=1TO3:READ HX%(HE%),HY%(HE%):PRINTTAB(HX%(HE%),HY%(HE%));H$:NEXT
1110ENDPROC
1120RESTORE1220:RETURN
1130RESTORE1230:RETURN
1140RESTORE1240:RETURN
1150RESTORE1250:RETURN
1160RESTORE1260:RETURN
1170RESTORE1270:RETURN
1180RESTORE1280:RETURN
1190RESTORE1290:RETURN
1200RESTORE1300:RETURN
1210RESTORE1310:RETURN
1220DATA10,10,3,4,10,16
1230DATA10,15,2,8,9,9
1240DATA3,7,3,18,18,7
1250DATA5,6,9,16,2,3
1260DATA6,6,7,6,5,6
1270DATA3,5,4,6,5,7
1280DATA17,2,16,2,15,15
1290DATA3,4,4,3,8,10
1300DATA2,4,4,5,15,15
1310DATA2,5,8,7,7,8
1320DEFPROCDONEIT
1330CLS
1340COLOUR12:PRINT'" Congratulations!"
1350COLOUR13:PRINT'" You have finished!"
1360COLOUR11:PRINT'" BEAT THE BULL"
1370COLOUR7:PRINT'''''''''''"Now let someone else"'" have a go!"
1380REPEATUNTILINKEY(-99)
1390ENDPROC