dos33fsprogs/ksp/applesoft/physics.bas
2016-06-20 23:04:32 -04:00

76 lines
1.6 KiB
QBasic

5 HGR:HCOLOR=3
7 HOME
10 PRINT CHR$(4);"BLOAD GLOBE.HGR,A$2000"
3000 AN=0.785
3001 CM=1
3002 E=3
3003 EI=270
3004 EM=1.5*E
3005 ET=168*E
3006 T=6
3007 KM=0.5*T
3008 FM=4.0*T
3009 TF=FM
3010 FL=100
3011 G=-9.8
3012 GX=0:GY=-9.8:GA=0
3013 V=0:VX=0:VY=0
3014 AX=0:AY=0
3015 KR=600000
3016 RX=0:RY=KR+10
3017 RA=KR
3018 S=1:TH=1:T=0
3020 TM=EM+KM+FM+CM
3021 MT=TM-FM
3022 DV=EI*G*LOG(TM/MT)
3025 TW=ET/(TM*-G)
3030 FR=ET/(EI*-G)
3035 PRINT "DELTAV=";DV
3040 PRINT "THRUST/WEIGHT=";TW
3050 PRINT "FUEL FLOW RATE=";FR
4000 REM
4010 FL=FM*100/TF
4020 IF TH<>1 THEN GOTO 4050
4025 IF FM<0.1 THEN FM=0:AX=0:AY=0:GOTO 4050
4030 AX=(ET/TM)*SIN(AN)
4035 AY=(ET/TM)*COS(AN)
4037 REM PRINT "ET=";ET;" TM=";TM
4040 FM=FM-FR
4045 TM=EM+KM+FM+CM
4047 GOTO 4060
4050 REM NOT THRUSTING
4055 AX=0:AY=0
4060 GA=ATN(RX/RY)
4062 REM PRINT "GA=";GA;" AY=";AY
4065 IF RY<0 THEN GA=GA+3.14
4070 GY=COS(GA)*G
4075 GX=SIN(GA)*G
4080 AY=AY+GY
4085 AX=AX+GX
4090 ZX=VX
4095 ZY=VY
5000 VY=ZY+AY
5005 VX=ZX+AX
5010 V=SQR(VX*VX+VY*VY)
5012 RY=RY+0.5*(ZY+VY)
5014 RX=RX+0.5*(ZX+VX)
5018 RA=SQR(RX*RX+RY*RY)
5020 IF RA<KR THEN PRINT "CRASH": END
5030 G=-9.8/((RA/KR)*(RA/KR))
5031 REM PRINT "-------------------------"
5032 VTAB 21
5040 PRINT "TIME: ";T,"STAGE: ";S
5045 PRINT "ALT: ";INT((RA-KR)/1000);"KM "
5060 PRINT "VEL: ";INT(V);"M/S","FUEL: ";INT(FL);"% "
5080 REM PRINT "GRAVANGLE ";GA*180/3.14
5090 REM PRINT "X: ";RX;" Y: ";RY
5100 REM PRINT "VX: ";VX;" VY: ";VY
5110 REM PRINT "ANGLE: ";AN
5112 REM PRINT "AX: ";AX;"AY: ";AY
5118 T=T+1
5120 REM GET A$:IF A$="Q" THEN END
5130 HX=INT(RX/25000)+140:HY=INT(-RY/25000)+85
5135 REM CHECK BOUNDS
5140 HPLOT HX,HY
5150 GOTO 4000