Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:55 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MicroMite - LUNAR LANDER MKII

Author Message
Chris Roper
Senior Member

Joined: 19/05/2015
Location: South Africa
Posts: 280
Posted: 01:02am 20 Sep 2015
Copy link to clipboard 
Print this post

I was reading some old issues of Kilobaud and came across this little program in the August 1978 Issue. Luna Lander used to be the game I used to test HP and other Programmable Calculators, longer ago than I care to remember, and thought it would be fun to add to the Micromite as a test of porting older programs to MMBasic.

It could form the basis of a graphics game for those playing with Colour Displays but even if you don't want to convert it to graphics it is still a fun diversion with only console output.
[code]
PRINT TAB(8);"LUNAR LANDER MKII"
PRINT TAB(8); "+++++++++++++++++"
PRINT
PRINT "WOULD YOU LIKE INSTRUCTIONS?"
PRINT "1= YES 0=NO"
INPUT A
IF A = 0 GOTO Decent
PRINT "YOU HAVE 120 LBS OF FUEL"
PRINT "YOU ARE APPROACHING THE LUNAR"
PRINT "SURFACE AT 50 FT/SEC, AND"
PRINT "ARE CURRENTLY 500 FT FROM"
PRINT "THE SURFACE, TO CANCEL"
PRINT "GRAVITY BURN 5LB FUEL"
Decent:
PRINT "HAPPY LANDINGS!"
LET F = 120
LET V = 50
LET D = 500
Guages:
PRINT "FUEL"; F
PRINT "SPEED"; V
PRINT "DISTANCE"; D
GetFuel:
PRINT "ENTER YOUR BURN".
INPUT B
IF B > F GOTO GetFuel
LET F = F-B
LET C = B-5
LET D = D-V+C/2
LET V = V-C
IF D > 0 GOTO Guages
IF V < 5 GOTO Touchdown
PRINT "****!!CRASH!!****"
PRINT "YOU HIT THE MOON AT";V;"FT/SEC"
GOTO Retry
Touchdown:
PRINT "WELL DONE — YOU LANDED OK"
PRINT "LANDING SPEED";V;"FT/SEC"
Retry:
PRINT "DO YOU WANT ANOTHER TRY?"
PRINT "1=YES, 0=NO"
INPUT A
IF A = 1 GOTO Decent
END
[/code]

Cheers,
Chris




http://caroper.blogspot.com/
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1593
Posted: 01:23am 20 Sep 2015
Copy link to clipboard 
Print this post

Thank you! Very old memories ...

I have already two versions for the Maximite.
Maybe I'll convert your code in a more modern style?

My first try:


Michael

causality ≠ correlation ≠ coincidence
 
Chris Roper
Senior Member

Joined: 19/05/2015
Location: South Africa
Posts: 280
Posted: 01:28am 20 Sep 2015
Copy link to clipboard 
Print this post

Thanks, that is the only piece of code I haven't tested as I haven't landed it yet

Yes it could do well with some more modern structure, but as a test it worked well.
All I had to do was strip out the line numbers and add the labels.
I could probably have even left the Line numbers too

Cheers
Chris

http://caroper.blogspot.com/
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1593
Posted: 01:38am 20 Sep 2015
Copy link to clipboard 
Print this post

  Chris Roper said   Thanks, that is the only piece of code I haven't tested as I haven't landed it yet


The "trick" is to do nothing till you're halfway down.
(0,0,5,13,20,13,0,0,0,0,30,25)
  Chris Roper said  I could probably have even left the Line numbers too

of course!

causality ≠ correlation ≠ coincidence
 
Chris Roper
Senior Member

Joined: 19/05/2015
Location: South Africa
Posts: 280
Posted: 02:03am 20 Sep 2015
Copy link to clipboard 
Print this post

I see you take a different approach, I was going for a gradual decent whereas you come in fast with a major burn at the last second. It was quite nerve wrecking doing it your way, I almost panicked as I typed in that last second burn

Cheers
Chris

http://caroper.blogspot.com/
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1593
Posted: 02:57am 20 Sep 2015
Copy link to clipboard 
Print this post

  Chris Roper said  I almost panicked as I typed in that last second burn




This is my conversion (works for Maximites too):

' Lunar Lander
' by Chris Roper@TBS 9/2015

Dim f,v,d ' fuel,speed,distance
Dim a,b ' input vars

Print
Print Tab(8);"LUNAR LANDER MKII"
Print Tab(8);"+++++++++++++++++"
Print
Print "WOULD YOU LIKE INSTRUCTIONS?"
Input "1= YES 0=NO"; A
If A Then show_instructions
Do
Print "HAPPY LANDINGS!"
F = 120
V = 50
D = 500

Do
Print "FUEL"; F
Print "SPEED"; V
Print "DISTANCE"; D
Do
Input "ENTER YOUR BURN"; B
Loop While B > F
F = F-B
C = B-5
D = D-V+C/2
V = V-C
Loop While D > 0
If V < 5 Then
Print "WELL DONE YOU LANDED OK"
Print "LANDING SPEED";V;"FT/SEC"
Else
Print "****!!CRASH!!****"
Print "YOU HIT THE MOON AT";V;"FT/SEC"
EndIf
Print "DO YOU WANT ANOTHER TRY?"
Input "1=YES, 0=NO"; A
Loop While a
End

Sub show_instructions
Print "YOU HAVE 120 LBS OF FUEL"
Print "YOU ARE APPROACHING THE LUNAR"
Print "SURFACE AT 50 FT/SEC, AND"
Print "ARE CURRENTLY 500 FT FROM"
Print "THE SURFACE, TO CANCEL"
Print "GRAVITY BURN 5LB FUEL"
Print
End Sub

causality ≠ correlation ≠ coincidence
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1132
Posted: 08:40am 22 Sep 2015
Copy link to clipboard 
Print this post

  Chris Roper said  I almost panicked as I typed in that last second burn

For some serious brown pants, try this sequence:

(0,0,0,0,0,0,0,15,75) - check the number of zero burns, might be one more or less.

Total fuel used: 90 lbs.

----------------
I might actually remember this game as a kid, from Creative Computing or some such. It is interesting to ponder this now and wonder why the computer wasn't used to solve the problem, instead of presenting it. Not that that has changed much over the years - only the graphics and sound have gotten better.

I've got to dig out "Hunt the Wumpus"...
Visit Vegipete's *Mite Library for cool programs.
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1593
Posted: 09:00am 22 Sep 2015
Copy link to clipboard 
Print this post

  vegipete said  Total fuel used: 90 lbs.

90 lbs.?

86 lbs. should be enough!

  vegipete said  ... and wonder why the computer wasn't used to solve the problem, instead of presenting it.

that's what I thought!
causality ≠ correlation ≠ coincidence
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025