Saturday, February 24, 2024

Swiss Micros DM42 and HP 42S: Moon Landing Simulator from the HP 33-E Applications Book

Swiss Micros DM42 and HP 42S: Moon Landing Simulator from the HP 33-E Applications Book



Landing the Rocket


The goal is to provide enough fuel to get the rocket to land on the moon safely. The use of fuel pushes the rocket away from the surface and slow down the descent. Don’t crash or use too much fuel to escape into space.


Variables:


X: Position

V: Velocity

F: Fuel

G: Gravity

B: Amount of Fuel to burn


Initial Values (from the HP-33E Applications):

X = 500

V = -50

F = 120

G = 5


I wasn't sure about the win condition (X = 0, V = 0?).


I show the position, velocity, and fuel after each successful turn. Enter the amount of units to burn at the burn prompt.



Download here: https://drive.google.com/file/d/1YsYzIMxALuRx_MHSSzGFFEQJdrN656DS/view?usp=sharing



DM42 and HP 42S Code: MOON


00 { 184-Byte Prgm }

01▸LBL "MOON"

02 500

03 STO "X"

04 -50

05 STO "V"

06 120

07 STO "F"

08 5

09 STO "G"

10▸LBL 01

11 "POS:"

12 ARCL "X"

13 AVIEW

14 STOP

15 "VEL:"

16 ARCL "V"

17 AVIEW

18 STOP

19 "FUEL:"

20 ARCL "F"

21 AVIEW

22 STOP

23 RCL "X"

24 X=0?

25 GTO 07

26▸LBL 02

27 "BURN?"

28 PROMPT

29 STO "B"

30 RCL "F"

31 X<Y?

32 GTO 05

33▸LBL 03

34 RCL "B"

35 STO- "F"

36 RCL- "G"

37 STO "A"

38 RCL "V"

39 RCL+ "X"

40 RCL "A"

41 2

42 ÷

43 +

44 STO "X"

45 X≥0?

46 GTO 04

47 GTO 06

48▸LBL 04

49 RCL "V"

50 RCL+ "A"

51 STO "V"

52 GTO 01

53▸LBL 05

54 2

55 RCL× "G"

56 RCL "V"

57 X↑2

58 +

59 SQRT

60 +/-

61 STO "V"

62▸LBL 06

63 "VEL:"

64 ARCL "V"

65 AVIEW

66 "YOU LOSE"

67 AVIEW

68 RTN

69▸LBL 07

70 "SUCCESS!"

71 AVIEW

72 .END.



Example Game


XEQ "MOON"


Initial Turn

POS: 500

VEL: -50

FUEL: 120


BURN? 0

POS: 447.5

VEL: -55

FUEL: 120


BURN? 0

POS: 390

VEL: -60

FUEL: 120


BURN? 0

POS: 327.5

VEL: -65

FUEL: 120


BURN? 5

POS: 262.5

VEL: -65

FUEL: 115


BURN? 0

POS: 195

VEL: -70

FUEL: 115


BURN? 5

POS: 125

VEL: -70

FUEL: 115


BURN? 10

POS: 57.5

VEL: -65

FUEL: 100


BURN? 12.5

"YOU LOSE" -3.75


So close. Good luck!



Source


HP-33 Applications. Hewlett Packard. Corvallis, OR. February 1978



Eddie


All original content copyright, © 2011-2024. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Spotlight: Akron Brass FireCalc Pocket Computer

Spotlight: Akron Brass FireCalc Pocket Computer Welcome to a special Monday Edition of Eddie’s Math and Calculator blog. Thi...