home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG166.ARC
/
BASGAMES.LBR
/
GRANPRIX.BZS
/
GRANPRIX.BAS
Wrap
BASIC Source File
|
1979-12-31
|
8KB
|
239 lines
10 PRINT CHR$(26);TAB(26);"GRANPRIX"
12 PRINT TAB(20);"CREATIVE COMPUTING"
14 PRINT TAB(18);"MORRISTOWN, NEW JERSEY"
16 PRINT:PRINT:PRINT
18 DIM P(9),F(4),G(4),H(82)
20 FOR X=1 TO 9
22 READ P(X)
24 NEXT X
26 FOR I=1 TO 4
28 READ G(I),F(I)
30 LET G(I)=G(I)/2.04545
32 LET F(I)=(F(I)+.61/2.04545)
34 NEXT I
36 FOR X=1 TO 82:READ H(X):NEXT X
38 DEF FNA(X)=INT(X*2.04545+.05)
40 DEF FNT(T)=INT(T*10+.5)/10
42 DEF FNC(T)=-(INT(T*R)+2)*(INT(T*R)+2<82)-82*(82<INT(T*R)+2)
44 DEF FNB(T)=-(INT(T*R)+1)*(INT(T*R)+1<82)-82*(82<INT(T*R)+1)
46 DEF FNQ(T)=H(FNC(T))-H(FNB(T))
48 DEF FNR(T)=T*R-INT(T*R)
50 DEF FNP(T)=INT(H(FNB(T))+FNQ(T)*FNR(T)+.5)
52 LET D=2
54 PRINT
56 PRINT "WELCOME TO THE PUC GRAN PRIX"
58 PRINT
60 PRINT "DO YOU WANT A COURSE DESCRIPTION";
62 INPUT A$
64 IF LEFT$(A$,1)<>"Y" THEN 206
66 PRINT "MAKE SURE YOUR PRINTER IS READY."
68 LINE INPUT "ENTER 'RETURN' TO BEGIN PRINTING. ";XX$
70 PRINT:PRINT "--- PRINTING ---":PRINT
72 LPRINT TAB(23);"2";TAB(66);"1"
74 LPRINT TAB(21);"CC0XPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX0CC"
76 LPRINT TAB(12);"85-100 CC (800)";TAB(69);"C"
78 LPRINT TAB(18);"C";TAB(70);"C"
80 LPRINT TAB(15);"3 0";TAB(21);"PUC GRAN PRIX RACE";TAB(70);"C"
82 LPRINT TAB(16);"X";TAB(69);"C"
84 LPRINT TAB(15);"X";TAB(67);"CC"
86 LPRINT TAB(14);"X";TAB(38);"SS";TAB(59);"(2800) C 50-"
88 LPRINT TAB(13);"X";TAB(22);"SSSSSSS SSS SSSOXXXXXXXXXXXXXXXX";
90 LPRINT "XPXXOC 70"
92 LPRINT TAB(12);"X SS SSSSSSS 7";
94 LPRINT TAB(64);"8"
96 LPRINT TAB(11);"X (1900)0 6 90-110"
98 LPRINT TAB(10);"X X"
100 LPRINT TAB(9);"X X";
102 LPRINT TAB(28);"DISTANCES IN YARDS, EG. ";
104 LPRINT "(800) = 800 YDS."
106 LPRINT TAB(8);"X X";TAB(20);"SPEEDS IN MPH, ";
108 LPRINT "EG. 85 TO 100 MPH."
110 LPRINT " P X"
112 LPRINT " X X"
114 LPRINT " X X"
116 LPRINT " X X"
118 LPRINT " 4 0(1500) X"
120 LPRINT " H X"
122 LPRINT " H X"
124 LPRINT "20-H 0 5"
126 LPRINT " 35 H H"
128 LPRINT " HH"
130 LPRINT
132 LPRINT
134 LPRINT "1 TO 2 IS A STRAIGHTAWAY 800 YARDS LONG"
136 LPRINT "2 TO 3 IS A CURVE 200 YARDS LONG"
138 LPRINT " THE BREAKAWAY SPEED RANGE IS 85 TO 100 MPH"
140 LPRINT "3 TO 4 IS A STRAIGHTAWAY 500 YARDS LONG"
142 LPRINT " IT ENDS AT POSITION 1500 YARDS FROM STARTING";
144 LPRINT " GRID"
146 LPRINT "4 TO 5 IS A HAIRPIN CURVE 100 YARDS LONG"
148 LPRINT " THE BREAKAWAY SPEED RANGE IS 20 TO 35 MPH"
150 LPRINT "5 TO 6 IS ANOTHER STRAIGHTAWAY 300 YARDS LONG"
152 LPRINT " IT ENDS AT POSITION 1900 YARDS FROM THE GRID"
154 LPRINT "6 TO 7 IS A SET OF 'S' CURVES 500 YARDS LONG"
156 LPRINT " THE SPEED RANGE IS 90-110 MPH"
158 LPRINT "7 TO 8 IS THE FINAL STRAIGHTAWAY OF 400 YARDS"
160 LPRINT " IT ENTERS THE LAST CURVE AT 2800 YARDS"
162 LPRINT "8 TO 9 IS THE FINAL CURVE OF 400 YARDS"
164 LPRINT " THE BREAKAWAY SPEED RANGE IS 50 TO 70 MPH"
166 LPRINT CHR$(12)
168 PRINT:PRINT "THE TOTAL LENGTH OF ONE LAP IS 3200 YARDS"
170 PRINT
172 PRINT "DURING THE STRAIGHTAWAYS YOU WILL BE ABLE TO CONTROL THE"
174 PRINT "ACCELERATION AND BRAKING OF THE CAR. THE CURVES WILL BE";
176 PRINT " TAKEN"
178 PRINT "AT WHATEVER SPEED YOU ENTER THEM."
180 PRINT "BELOW THE BREAKAWAY SPEED, THE CURVES MAY BE TAKEN WITH ";
182 PRINT "NO DIFFICULTY."
184 PRINT "ABOVE THE FASTEST SPEED INDICATED, YOU WILL CRASH!!"
186 PRINT "WITHIN THE SPEED RANGE, THERE IS THE POSSIBILITY THAT YOU";
188 PRINT " MIGHT"
190 PRINT "LOSE TIME OR SPEED BY SWINGING WIDE OR BY SPINNING OUT."
192 PRINT "THE FASTER YOU TAKE THE CURVES, THE GREATER THE RISKS--"
194 PRINT "AND THE LESS THE TIME!!!!"
196 PRINT
198 PRINT
200 PRINT "YOUR TASK IS TO TRANSVERSE THE TRACK IN A MINIMUM OF TIME"
202 PRINT "WITHOUT CRASHING!!!"
204 PRINT
206 PRINT:PRINT "YOUR CAR MAY BE ONE OF THE FOLLOWING:"
208 PRINT "1. PORSCHE"
210 PRINT "2. FERRARI"
212 PRINT "3. MASERATI"
214 PRINT "4. LOTUS FORD"
216 PRINT:PRINT "WHICH CAR WOULD YOU LIKE";
218 INPUT Z:PRINT
220 ON Z GOTO 226,232,238,244
222 PRINT "WE DON'T HAVE THAT CAR IN STOCK, PLEASE CHOOSE AGAIN.";
224 GOTO 218
226 M=15
228 LET B=-20
230 GOTO 248
232 M=10
234 B=-25
236 GOTO 248
238 M=12
240 B=-22
242 GOTO 248
244 M=8
246 B=-30
248 PRINT "YOUR CAR HAS A MAXIMUM ACCELERATION OF";M;"MPH/SEC."
250 PRINT "AND A MAXIMUM BRAKING OF ";B;"MPH/SEC."
252 PRINT:PRINT "YOU WILL RACE AGAINST ONE OF THE FOLLOWING:"
254 PRINT "1. U.S. POSTAL DELIVERY TRUCK"
256 PRINT "2. 1970 BEAT PONTIAC GTO"
258 PRINT "3. 1966 WELL USED FORD MUSTANG"
260 PRINT "4. LOTUS FORD"
262 PRINT "5. 1974 FERRARA"
264 PRINT "6. THE PHYSICS SUPERCHARGED LIGHTBEAM SPECIAL":PRINT
266 PRINT "CHOOSE ONE OPPONENT BY ENTERING NUMBER";
268 INPUT R1
270 IF R1>0 AND R1<6 THEN 278
272 IF R1=6 THEN 282
274 PRINT "WHICH CAR DID YOU SAY";
276 GOTO 268
278 LET R=2*R1-5
280 GOTO 284
282 LET R=2.5E+08
284 LET R=(90+2*R)/100+7*RND(1)/100
286 PRINT
288 REM BEGIN THE RACE!!
290 LET J=1
292 PRINT "ELAPSED-TIME SPEED POSITION OPPONENT'S"
294 PRINT " SECONDS MPH YARDS POSITION ACCELERATION"
296 PRINT "----------- ----- -------- ---------- ------------"
298 PRINT
300 X=0:S=0:T=0:T9=0:X9=0
302 REM
304 IF J<9 THEN 324
306 PRINT
308 PRINT "COMPLETED LAP";",ELAPSED TIME";FNT(T);"SEC."
310 PRINT "YOUR OPPONENT FINISHED IN";80/R;"SECONDS"
312 LET K1=FNT(T)-80/R
314 IF K1>0 THEN 320
316 PRINT "CONGRATULATIONS, YOU WON BY";-K1;"SECONDS"
318 GOTO 452
320 PRINT "SORRY, YOU LOST BY";K1;"SECONDS"
322 GOTO 452
324 IF FNP(T) > 3200 THEN 330
326 PRINT USING " ###.# ### #### #### ";FNT(T);FNA(S);INT(X);FNP(T);
328 GOTO 332
330 PRINT " ";FNT(T)," ";FNA(S)," ";INT(X)," FINISH"," ";
332 INPUT A1
334 LET A=A1/2.04545
336 IF A1>=0 THEN 392
338 IF A1>=B THEN 344
340 PRINT "MAXIMUM BRAKING IS ";B;"MPH/SEC"
342 GOTO 324
344 LET T1=-S/A
346 IF T1>D THEN 380
348 LET X1=X+S*T1+A/2*T1*T1
350 IF X1>P(J+1) THEN 362
352 PRINT "YOU STOPPED";INT(P(J+1)-X1);"YARDS FROM POINT";J+1
354 LET S=0
356 LET X=X1
358 LET T=T+T1
360 GOTO 304
362 LET Y=P(J+1)-X
364 IF A<>0 THEN 370
366 LET T=T+Y/S
368 GOTO 376
370 LET S1=SQR(S*S+2*A*Y)
372 LET T=T-(S-S1)/A
374 LET S=S1
376 LET J=J+1
378 GOTO 404
380 LET X1=X+S*D+A/2*D*D
382 IF X1>P(J+1) THEN 362
384 LET T=T+D
386 LET S=S+A*D
388 LET X=X1
390 GOTO 304
392 IF A1 <= M THEN 398
394 PRINT "MAXIMUM ACCELERATION IS";M;"MPH/SEC"
396 GOTO 324
398 LET X1=X+S*D+A/2*D*D
400 IF X1>P(J+1) THEN 362
402 GOTO 380
404 REM *** SUB CURVE ***
406 LET I=INT(J/2)
408 LET T1=(P(J+1)-P(J))/S
410 LET S1=G(I)+(F(I)-G(I))*RND(1)
412 IF S>S1 THEN 424
414 PRINT "CURVE";J;-J-1;", SPEED";FNA(S);"MPH"
416 LET J=J+1
418 LET X=P(J)
420 LET T=T+T1
422 GOTO 304
424 IF S>S1+(F(I)-S1)/2 THEN 436
426 LET T2=T1*RND(1)*.4
428 PRINT "SPEED IN CURVE";FNA(S);"MPH, TOOK CURVE WIDE, LOST";
430 PRINT FNT(T2);"SEC."
432 LET T1=T1+T2
434 GOTO 416
436 IF S>F(I) THEN 448
438 LET S2=S-S*RND(1)*.9
440 LET T1=T1*S/S2
442 PRINT "SPUN OUT AT";FNA(S);"MPH, LOST SPEED AND TIME"
444 LET S=S2
446 GOTO 416
448 PRINT "LOST CONTROL AT";FNA(S);"MPH. YOUR CAR CRASHED!!"
450 PRINT "YOUR OPPONENT FINISHED IN";82/R;"SECONDS!"
452 PRINT
454 PRINT "DO YOU WISH TO TRY AGAIN";
456 INPUT A$
458 IF LEFT$(A$,1)="Y" THEN 206
460 DATA 0,800,1000,1500,1600,1900,2400,2800,3200
462 DATA 85,100
464 DATA 20,35
466 DATA 90,110
468 DATA 50,70
470 DATA 0,1,3,9,21,39,62,87,120,156,196,244,293,351,410
472 DATA 479,550,625,700,758,800,847,894,942,990,1030,1080
474 DATA 1135,1200,1260,1330,1382,1425,1470,1490,1505,1519
476 DATA 1539,1548,1563,1578,1512,1610,1632,1658,1683,1718
478 DATA 1758,1800,1850,1890,1943,1997,2050,2104,2057,2210
480 DATA 2294,2317,2370,2420,2480,2535,2600,2670,2725,2768,2799,2830
482 DATA 2861,2892,2920,2951,2982,3013,3044,3075,3106,3137,3168,3199
484 DATA 10000