11 Oct, 2025
Click the window to enter text.
Each turn enter the amount of Thrust you want to apply to slow your descent. If you run out of fuel or fall too fast, you will crash. Try not to crash.
Adapted from a listing in Tim Hartnell's Giant Book of Computer Games, refactored and adapted for the Basic Anywhere Machine.
<h2>The Listing</h2>
PRINT TAB(11); "**********************************************************"
PRINT TAB(11); "**********************************************************"
PRINT TAB(11); "** **"
PRINT TAB(11); "** MOONLANDER **"
PRINT TAB(11); "** **"
PRINT TAB(11); "** As seen in Tim Hartnel's Giant Book of Computer Games**"
PRINT TAB(11); "** Converted and refactored by Michael Coorlim **"
PRINT TAB(11); "** **"
PRINT TAB(11); "**********************************************************"
PRINT TAB(11); "**********************************************************"
PRINT:PRINT:PRINT
Stripped out all the line numbers and implemented labels.
REM ** Initialization **
HS = -10000 : REM ** HIGH SCORE
input "Instructions? (Y/N)" A$
if LEFT$(A$,1) = "Y" or LEFT$(A$,1) = "y" THEN
?:?"In Moonlander you are trying to land safely on the moon."
?"Your only control is how much thrust to apply on any given turn."
?"This uses up your limited fuel, but slows your descent."
?"Try and slow enough so that your landing doesn't cause a crater."
?"And, of course, without running out of fuel."
?"Press a key to continue."
END IF
SLEEP
Added instructions; the listing lacked them.
INIT:
VELOCITY = -20-INT(RND(1)*60): REM Initial velocity
ALTITUDE = 1200 + INT(RND(1)*380):REM Height
FUEL = 320 + INT(RND(1)*90): REM Fuel
Original variable names were A, B, and C. I've renamed them. Also had to change the structure of the RND statements from (RND(number)) to RND(1)*number).
START_LOOP:
CLS
PRINT:PRINT:PRINT
ALTITUDE = INT(ALTITUDE):VELOCITY = INT(VELOCITY):FUEL = INT(FUEL)
REM ** Display **
PRINT "Altitude:";ALTITUDE,"Velocity: ";VELOCITY
PRINT" Fuel:";FUEL
REM ** PRINT THE SHIP **
FOR Q = 1 TO 16-ALTITUDE/100
PRINT
NEXT Q
PRINT TAB(5 + INT(RND(1)*3) -INT(RND(1)*3));"<*>"
Didn't change much here, though I could have made a better looking "ship" with CHR$ codes.
REM ** FALL **
FOR Q = 16-ALTITUDE/100 TO 16
PRINT
NEXT Q
FOR P = 1 TO 500:NEXT P : REM ** 2 second pause
INPUT "Thrust";THRUST
FOR P = 1 TO 500:NEXT P
IF THRUST > FUEL THEN THRUST = 0
FUEL = FUEL - THRUST
ALTITUDE = ALTITUDE + VELOCITY + (THRUST - 5)/2
VELOCITY = VELOCITY + (THRUST - 5)/2
IF FUEL < 1 AND ALTITUDE > 100 THEN GOTO OUTAGAS
IF ABS(ALTITUDE) < 20 AND ABS(VELOCITY) < 15 THEN
PRINT "You have landed safely"
PRINT:PRINT "Well done, intrepid captain"
SCORE = FUEL*234
GOTO SHOW_SCORE
END IF
IF ALTITUDE > 19 THEN GOTO START_LOOP
IF FUEL > 1 THEN GOTO CRASH
Left the main loop basically untouched.
OUTAGAS:
PRINT "You have run out of fuel"
CRASH:
PRINT "Your ship crashed at ";ABS(VELOCITY);" kph"
PRINT "creating a ";INT(ABS(VELOCITY)*45);" meter deep crater"
SCORE = 100 -ABS(VELOCITY)
SHOW_SCORE:
FOR P = 1 TO 1000:NEXT P
PRINT:PRINT
PRINT "Your galactic rating is ";SCORE
IF SCORE > HS THEN HS = SCORES
PRINT:PRINT "Best rating so far is ";HS
PRINT:PRINT "Press any key for your next mission"
SLEEP
GOTO INIT
Originally the program gave a several second delay with a For/Next loop before restarting. I replaced this with a SLEEP to let the player tap a key instead.
#Tim Hartnell