-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path16_Factors.bc2
309 lines (308 loc) · 9.65 KB
/
16_Factors.bc2
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
1000 A=100:GOTO20:REM FACTORS
1010 GOTO2570:REM INITIALIZATION
1020 REM START OF MAIN PROGRAM
1030 GOSUB100:PRINT"Good, we can start then..."
1040 PRINT:PRINT
1050 PRINT"Decide who will be player A and B."
1060 PRINT
1070 PRINT"Tell me how far I should fill"
1080 PRINT"in the table.":PRINT
1090 PRINT"So, choose a number":PRINT
1100 PRINT"between 3 and 91";
1110 INPUTGI
1120 IFGI<92 ANDGI>2 THEN1190
1130 PRINT:PRINT"Your choice was ";GI;" but that doesn't"
1140 PRINT"lie between 3 and 91 does it ?"
1150 PRINT:PRINT
1160 PRINT"T r y A g a i n ! "
1170 FORI=1 TO90*TF:NEXTI
1180 GOTO1030
1190 BE=0:GOSUB2360
1200 GOSUB2100:REM FILL IN TO GI
1210 FORGW=2 TOGI:GT(GW)=1:NEXTGW:IFGI=91 THEN1240
1220 FORGW=GI+1 TO91:GT(GW)=0
1230 NEXTGW
1240 SA=0:SB=0:REM SCORES
1250 GOSUB2450:GOSUB2240:REM PRINT THE RESULTS
1260 FORI=1 TO30*TF:NEXTI
1270 VE=21:HO=0:GOSUB110:PRINTSP$:PRINTSP$:PRINTSP$;
1280 VE=21:HO=0:GOSUB110
1290 PRINT"Player ";CHR$(65+BE);" selects: ";
1300 GOSUB2160
1310 HG=18:GI=0:TE=30:TP=0:CS=1:GOTO1420
1320 GOSUB2190:REM GET KR
1330 IFIN$="" THEN1390
1340 IFKR=13 THEN1450
1350 KR=KR-48:IFKR<0 ORKR>9 THEN1390
1360 GI=10*GI+KR
1370 VE=21:HO=18:GOSUB110:SR=GI:GOSUB300:PRINTSR$
1380 HG=HG+1
1390 TE=TE+1:IFTE+TE<TF THEN1320
1400 TE=0:HO=HG:VE=21:GOSUB110
1410 PRINTMID$("ox",CS,1):CS=3-CS
1420 TP=TP+CS-1
1430 VE=10:HO=30:GOSUB110:PRINT"Time: ";:SR=TP
1440 GOSUB300:PRINTSR$;" ":GOTO1320
1450 REM NUMBER IS CHOSEN
1460 HO=HG:VE=21:GOSUB110:PRINT" ";
1470 IFGI>91 THEN1490
1480 IFGT(GI)=1 THEN1540
1490 VE=22:HO=0:GOSUB110
1500 PRINT"Sorry ";CHR$(65+BE);", but that number has gone"
1510 PRINT"H a v e A n o t h e r G o ! ! ! ";
1520 FORI=1 TO40*TF:NEXTI
1530 GOTO1270
1540 PRINT"and gets ";
1550 SR=GI:GOSUB300
1560 PRINTSR$;" pts."
1570 GW=GI:GOSUB2300
1580 PRINT" "
1590 FORI=1 TO15*TF:NEXTI
1600 VE=23:HO=0:GOSUB110:PRINT"Player ";CHR$(66-BE);
1610 SR=TP:GOSUB300:PRINT" gets ";SR$;" pts";
1620 FORI=1 TO20*TF:NEXTI
1630 BR=9
1640 FORGW=2 TOGI-1
1650 IFGT(GW)=0 THEN1790
1660 IFGI<>GW*INT(GI/GW) THEN1790
1670 CT=2:CN=0:SR=GW:GOSUB310
1680 GOSUB2300:REM POSITION
1690 GOSUB250:FORI=1 TO20
1700 GOSUB110:IF2*INT(I/2)=I THEN1720
1710 PRINTSR$;:GOTO1730
1720 PRINT" ";
1730 FORII=1 TO5:NEXTII
1740 NEXTI
1750 TP=TP+GW
1760 VE=23:HO=14:GOSUB110
1770 SR=TP:GOSUB300
1780 PRINTSR$;" pts";
1790 NEXTGW
1800 GW=GI:GOSUB2300:PRINT" ";
1810 IFBE=0 THENSA=SA+GI:SB=SB+TP
1820 IFBE=1 THENSB=SB+GI:SA=SA+TP
1830 BE=1-BE
1840 FORJ=2 TO91:IFGT(J)=1 THENJ=100:NEXTJ:GOTO1250
1850 NEXTJ
1860 GOSUB100:PRINT" * * * F I N A L S C O R E * * * "
1870 PRINT" ********************************** "
1880 PRINT:PRINT
1890 PRINT"Player A has ";SA;" points,"
1900 PRINT:PRINT
1910 PRINT"Player B has ";SB;" points."
1920 W$="":IFSA>SB THENW$="A"
1930 IFSA<SB THENW$="B"
1940 IFW$="" THEN1980
1950 PRINT:PRINT:PRINT
1960 PRINT"So ";W$;" has won ! ! !"
1970 GOTO2000
1980 PRINT:PRINT:PRINT
1990 PRINT" It's a tie ! ! !"
2000 FORI=1 TO120*TF:NEXTI
2010 VE=17:HO=0:GOSUB110:PRINT"Want another game ?"
2020 GOSUB2160
2030 PRINT:PRINT"Press Y or N"
2040 GOSUB2190:IFIN$="" THEN2040
2050 IN$=CHR$(KR)
2060 IFIN$="y" ORIN$="Y" THEN1030
2070 PRINT"Shame, I was enjoying it."
2080 END
2090 REM SUBROUTINE FILL IN TO G1
2100 CT=2:CN=0
2110 FORSR=2 TOGI:GW=SR
2120 GOSUB2300:GOSUB310:PRINTSR$
2130 NEXTSR
2140 RETURN
2150 REM SR EMPTY INPUTBUFFER
2160 GOSUB200:IFIN$<>"" THEN2160
2170 RETURN
2180 REM SR GET ASCII CHR KR
2190 GOSUB200:IFIN$="" THENRETURN
2200 KR=ASC(IN$)
2210 IFKR>95 THENKR=KR-32:GOTO2210
2220 RETURN
2230 REM SR PRINT THE SCORE
2240 VE=6:HO=32:GOSUB110:SR=SA:GOSUB300:PRINTSR$
2250 VE=17:GOSUB110:SR=SB:GOSUB300:PRINTSR$
2260 GOSUB250
2270 FORI=1 TO3*TF:NEXTI
2280 RETURN
2290 REM SR POSITIONER FOR GW
2300 RE=INT((GW-2)/9):REM REGEL
2310 KO=GW-9*RE:REM KOLOM
2320 VE=RE+RE+1:HO=3*KO-5:GOSUB110
2330 GT(GW)=0
2340 RETURN
2350 REM SR SET NEW TABLE
2360 GOSUB100
2370 BO$="+--------------------------+"
2380 TR$="!--+--+--+--+--+--+--+--+--!"
2390 CR$="! ! ! ! ! ! ! ! ! !"
2400 PRINTBO$:PRINTCR$
2410 FORI=1 TO9:PRINTTR$:PRINTCR$:NEXTI
2420 PRINTBO$
2430 RETURN
2440 REM SUBROUTINE SCORE WINDOWS
2450 FORI=0 TO1
2460 HO=30:VE=1+11*I:GOSUB110:PRINT"+--------+"
2470 VE=VE+1:GOSUB110
2480 PRINT"!Player ";CHR$(65+I);"!"
2490 VE=VE+1:GOSUB110:PRINT"! !"
2500 VE=VE+1:GOSUB110:PRINT"! Score: !"
2510 FORII=1 TO3
2520 VE=VE+1:GOSUB110:PRINT"! !"
2530 NEXTII
2540 VE=VE+1:GOSUB110:PRINT"+--------+"
2550 NEXTI
2560 RETURN
2570 SP$=" "
2580 DIMGT(91)
2590 TF=30:REM THIS IS THE TIME
2600 REM FACTOR. MAKE IT LARGER
2610 REM FOR FASTER COMPUTERS,
2620 REM SMALLER ON SLOWER.
2630 GOSUB100
2640 PRINT" F A C T O R S "
2650 GOSUB2800
2660 PRINT:PRINT:PRINT:PRINT:PRINT:PRINT
2670 PRINT" An educational game for two players."
2680 GOSUB2800
2690 PRINT:PRINT:PRINT:PRINT
2700 PRINT" Need instructions ?"
2710 PRINT:PRINT" (answer with Y or N )"
2720 GOSUB2160:REM FLUSH BUFFER
2730 GOSUB2190:IFIN$="" THEN2730
2740 IN$=CHR$(KR)
2750 IFIN$="n" ORIN$="N" THEN1030
2760 IFIN$<>"y" ANDIN$<>"Y" THEN2730
2770 GOSUB100:GOSUB2850:GOSUB100:GI=25:GOTO1190
2780 GOTO1030:REM PROGRAM START
2790 REM SR WAIT UNTIL IN$
2800 FORI=1 TO100
2810 GOSUB200:IFIN$<>"" THENI=100
2820 NEXTI
2830 RETURN
2840 REM SRUITLEG
2850 RESTORE:CO=1
2860 GOSUB2160:REM FLUSH BUFFER
2870 READP$
2880 IFP$="*" THENFORI=1 TO1000:NEXTI:GOSUB100:GOTO2870
2890 GOSUB200:IFIN$="" THEN2910
2900 RETURN
2910 IFP$<>"$" THEN2970
2920 FORI=1 TO800:NEXTI
2930 GOSUB2360:REM PRINT TABLE
2940 GI=91:GOSUB2090:REM FILL IT
2950 FORI=1 TO2000:NEXTI
2960 GOTO2870
2970 IFP$="#" THENRETURN
2980 FORI=1 TOLEN(P$)
2990 T$=MID$(P$,I,1)
3000 IFT$="&" THENPRINT:GOTO3040
3010 IFT$="*" THENGOSUB120:GOTO3040
3020 IFT$="=" THENGOSUB110:GOTO3040
3030 PRINTT$;
3040 FORII=1 TOTF:NEXTII
3050 NEXTI
3060 FORII=1 TO200:NEXTII:PRINT:GOTO2870
25000 DATA " F A C T O R S "
25010 DATA "&&A game for two people."
25020 DATA "&The player who starts may choose a"
25030 DATA "number from the table."
25040 DATA "&&Hang on, you haven't played this yet"
25050 DATA "so I had better let you see"
25060 DATA "the table..."
25070 DATA "&&A moment please."
25080 DATA "$"
25090 DATA "*"
25100 DATA "&&See what I mean?"
25110 DATA "&You saw numbers in the table between"
25120 DATA "2 and 91. "
25130 DATA "&The player who starts may choose"
25140 DATA "a number from the table."
25150 DATA "&That number also becomes his/her"
25160 DATA "score !!"
25170 DATA "&&&&&So, if you choose 60, you get 60"
25180 DATA "points."
25190 DATA "&&But......"
25200 DATA "*"
25210 DATA "It is a bit more complicated."
25220 DATA "&Suppose you pick 60,"
25230 DATA "&then I quickly calculate that 60 "
25240 DATA "has a number of factors."
25250 DATA "&Namely: 2, 3, 4, 5, 6, 10, 12, 15,"
25260 DATA "20 and 30."
25270 DATA "&Added up that means 107."
25280 DATA "&And that means the OTHER player"
25290 DATA "gets those 107 points."
25300 DATA "*"
25310 DATA "Oh, and one more thing...."
25320 DATA "&&While you're figuring out which"
25330 DATA "number to choose, "
25340 DATA "time ticks onward... "
25350 DATA "second by second..... "
25360 DATA "& *1"," =2"," =3"," =4"
25370 DATA " =5"," =6"," =7"," =8"
25380 DATA " = "
25390 DATA "&&See that time on the screen?"
25400 DATA "Each second of thinking time means "
25410 DATA "another point for the second player."
25420 DATA " "
25430 DATA "*"
25440 DATA "Summary:"
25450 DATA "&Player one scores the value of"
25460 DATA "his/her chosen number. "
25470 DATA "&&The second player scores the number"
25480 DATA "of seconds thinking time "
25490 DATA "&plus the sum of all the factors in the"
25500 DATA "chosen number, "
25510 DATA "&providing they are still shown"
25520 DATA "in the table. "
25530 DATA "&As soon as a factor is chosen or is used"
25540 DATA "it will disappear, never to return... "
25550 DATA "*"
25560 DATA "Oh, one last request."
25570 DATA " "
25580 DATA "&I may ask you to give me a number."
25590 DATA "You do this by typing in the number,"
25600 DATA " "
25610 DATA "but you must not forget"
25620 DATA "to press <RETURN> after the last"
25630 DATA "figure has been pressed."
25640 DATA " "
25650 DATA "If you have to type anything in"
25660 DATA "I will make this sign:"
25670 DATA "& *x"
25680 DATA "=o","=x","=o","=x","=o","=x"
25690 DATA "=o","=x","=o","=x","=o","=x"
25700 DATA " =x"
25710 DATA "= "
25720 DATA "Understand ? "
25730 DATA "&If that sign flashes, I will wait"
25740 DATA "until you press a key."
25750 DATA "&&Please don't forget the <RETURN>"
25760 DATA "key, or I cannot continue."
25770 DATA "*"
25780 DATA "Perhaps the rules of the game may"
25790 DATA "still be confusing, but don't worry."
25800 DATA "&&&&If you get stuck, I will help you."
25810 DATA "&&&Let's have a go."
25820 DATA " "
25830 DATA "#"
25840 DATA "%"
30000 REM 2590-2620 CHECK THESE
30010 REM LINES IF THE GAME GOES TOO
30020 REM FAST OR TOO SLOW. ADJUST-
30030 REM MENT IS POSSIBLE.
30040 REM
30050 REM ADAPTED FOR BASICODE-2
30060 REM ON 27.12.82 by:
30070 REM
30080 REM
30090 REM J. HAUBRICH
30100 REM
30110 REM ORIGINAL BY SAME AUTHOR
30120 REM
30130 REM TRANSLATED FOR "RADIO ACTIVITY"
30140 REM
30150 REM BY JONATHAN MARKS 1.3.1984