How it works
The capsule starts 120 miles up, falling at one mile a second (3,600 mph), weighing 33,000 lb of which 16,500 lb is fuel. Every ten seconds you choose a burn rate in pounds of fuel per second. Gravity is 0.001 miles per second squared, which is 1.61 m/s², close to the Moon's. The exhaust leaves at 1.8 miles a second.
The program steps forward with Tsiolkovsky's rocket equation. It never calls a logarithm: the change in speed and height over each burn is written out as a five-term series instead.
420 Q=S*K/M: J=V+G*S+Z*(-Q-Q*Q/2-Q^3/3-Q^4/4-Q^5/5)
430 I=A-G*S*S/2-V*S+Z*S*(Q/2+Q^2/6+Q^3/12+Q^4/20+Q^5/30):RETURN
When a step would carry the capsule below the surface, it halves its way down to the exact touchdown time and reports your impact speed.
Where it comes from
The 1978 book BASIC Computer Games credits LUNAR to Jim Storer, who wrote it in DEC's FOCAL language as a student at Lexington High School; David Ahl converted it to BASIC. Hackaday's note on a new PDP-1 port says the first version ran on a PDP-8 in 1969.
The program's own introduction says CAPSULE WEIGHT 32,500 LBS; FUEL WEIGHT 16,000 LBS
, but its variables say 33,000 and 16,500. I kept both, as printed. The book's advice: slowing down too early leaves no fuel for the bottom of the fall. Number formatting here approximates the BASICs of the day.
Under 1.2 mph is a perfect landing. Over 60 mph, the program tells you how deep a crater you made. A search I ran found a perfect one, 0.47 mph after 194 seconds, so it can be done. I am not printing the burn rates.