home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug055.arc
/
DRAGRACE.BAS
< prev
next >
Wrap
BASIC Source File
|
1979-12-31
|
3KB
|
111 lines
100 DIM I$(3),P(2),E(2),W(2),S(2),X(2),M(2),C(2),B(2),Y(2)
110 DIM Q(2),MB(2)
120 PRINT "WELCOME TO THE DRAG STRIP."
130 PRINT "WOULD YOU LIKE INSTRUCTIONS";
140 INPUT I$
150 IF I$="NO" THEN 200
160 PRINT "YOU MAY RACE AGAINST ONE OF YOUR FRIENDS OR YOU MAY RACE"
170 PRINT "AGAINST MY DRAGSTER. YOU WILL BE ASKED TO DESIGN YOUR"
180 PRINT "OWN MACHINE, SPECIFYING HORSEPOWER, REAR END RATIO (X:1)"
190 PRINT "TIRE WIDTH IN INCHES AND TIRE DIAMETER IN FEET."
200 PRINT "DO YOU WANT TO RACE AGAINST ME";
210 INPUT I$
220 IF I$="NO" THEN 290
230 PRINT "I WILL HAVE CAR #1."
240 P(1)=600
250 E(1)=5.9
260 W(1)=22
270 D(1)=3.9
280 GOTO 380
290 PRINT "DESIGN CAR #1:"
300 PRINT "HORSEPOWER=";
310 INPUT P(1)
320 PRINT "REAR END RATO=";
330 INPUT E(1)
340 PRINT "TIRE WIDTH =";
350 INPUT W(1)
360 PRINT "TIRE DIAMITER=",
370 INPUT D(1)
380 PRINT "DESIGN CA #2:"
390 PRINT "HOURSEPOWER=";
400 INPUT P(2)
410 PRINT "REAR END RATIO=";
420 INPUT E(2)
430 PRINT "TIRE WIDTH=";
440 INPUT W(2)
450 PRINT "TIRE DIAMETER=";
460 INPUT D(2)
470 PRINT
480 PRINT "GO!"
490 K1=500
500 K2=1.6
510 K3=2
520 K4=6E-04
530 K5=6E-05
540 K6=.2
550 K7=4
560 K8=1.5E-04
570 Q(1)=0:Q(2)=0
580 S(1)=0:S(2)=0
590 X(1)=0:X(2)=0
600 FOR J=1TO2
610 M(J)=(K1+K2*P(J)+K3*W(J)*D(J)+K7*D(J)^2)/32.2
620 C(J)=K4*M(J)^(2/3)+K8*W(J)*D(J)
630 B(J)=15+28*W(J)*D(J)/((W(J)+6)*(D(J)+1))
640 Y(J)=3.7-3.3E-03*P(J)
650 MB(J)=M(J)*B(J)
660 NEXT J
670 PRINT
680 PRINT
690 PRINT "ELAPSED";TAB(21);"CAR#1";TAB(49);"CAR#2"
700 PRINT "TIME","SPEED","DISTANCE","SPEED","DISTANCE"
710 PRINT "(SEC)","(MPH)"," (FT)","(MPH)"," (FT)"
720 PRINT
730 FOR T=0 TO 100 STEP 1
740 FOR T1=1 TO 100 STEP 1
750 FOR J=1 TO2
760 R=60*S(J)*E(J)/(3.14159*D(J))
770 L0=(P(J)/42.5)*(50+7.8E-03*(R/Y(J))-4E-10*(R/Y(J))^3)
780 L1=P(J)*(K5*R+K6)
790 L2=E(J)*(L0-L1)
800 F=2*L2/D(J)
810 IF F>MB(J) THEN 870
820 IF Q(J)<>0 THEN 850
830 PRINT "CAR#";J;"STOPS BURNING RUBBER"
840 Q(J)=1
850 A=(F-C(J)*S(J)^2)/M(J)
860 GOTO 880
870 A=B(J)-C(J)*S(J)^2/M(J)
880 S(J)=S(J)+A*.01
890 X(J)=X(J)+S(J)*.01
900 NEXT J
910 IF X(1)<1320 AND X(2)<1320 THEN 1120
920 IF X(1)>X(2) THEN 1040
930 T3=(X(2)-1320)/S(2)
940 T=T+T1/100-T3
950 X(2)=1320
960 X(1)=X(1)-S(1)*T3
970 PRINT T,S(1)*3600/5280,X(1),S(2)*3600/5280,X(2)
980 PRINT TAB(50);"WINNER"
990 PRINT
1000 PRINT"DO YOU WANT TO TRY AGAIN",
1010 INPUT I$
1020 IF I$="YES" THEN 200
1030 STOP
1040 T3=(X(1)-5280/4)/S(1)
1050 T=T+T1/100-T3
1060 X(1)=5280/4
1070 X(2)=X(2)-S(2)*T3
1080 PRINT T,S(1)*3600/5280,X(1),S(2)*3600/5280,X(2)
1090 PRINT TAB(20);"WINNER"
1100 PRINT
1110 GOTO 1000
1120 NEXT T1
1130 PRINT T+1,S(1)*3600/5280,X(1),S(2)*3600/5280,X(2)
1140 NEXT T
1150 STOP
ER"
1100 PRINT
1110 GOTO 1000
1120 NEXT T1
1130 PRINT T+1,S(1)*3600/52