Created
June 3, 2009 13:51
-
-
Save fogus/122993 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Lunar extends Baysick { | |
def main(args:Array[String]) = { | |
10 PRINT "Welcome to Baysick Lunar Lander v0.9" | |
20 LET ('dist := 100) | |
30 LET ('v := 1) | |
40 LET ('fuel := 1000) | |
50 LET ('mass := 1000) | |
60 PRINT "You are drifting towards the moon." | |
70 PRINT "You must decide how much fuel to burn." | |
80 PRINT "To accelerate enter a positive number" | |
90 PRINT "To decelerate a negative" | |
100 PRINT "Distance " % 'dist % "km, " % "Velocity " % 'v % "km/s, " % "Fuel " % 'fuel | |
110 INPUT 'burn | |
120 IF ABS('burn) <= 'fuel THEN 150 | |
130 PRINT "You don't have that much fuel" | |
140 GOTO 100 | |
150 LET ('v := 'v + 'burn * 10 / ('fuel + 'mass)) | |
160 LET ('fuel := 'fuel - ABS('burn)) | |
170 LET ('dist := 'dist - 'v) | |
180 IF 'dist > 0 THEN 100 | |
190 PRINT "You have hit the surface" | |
200 IF 'v < 3 THEN 240 | |
210 PRINT "Hit surface too fast (" % 'v % ")km/s" | |
220 PRINT "You Crashed!" | |
230 GOTO 250 | |
240 PRINT "Well done" | |
250 END | |
RUN | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment