107a. Lunar lander reworked
I had another go at the lunar lander, this time from the top down, ie instead of building it a piece at a time, I designed the whole thing first. This is of course the right way to do anything, but it’s much less fun than just building it piece by piece. The code is here.
However, doing it this way clearly shows how state management – controlling which stage of the game you are in (start menu, playing, level 1, level 2, winning, losing etc) – is the basic framework of the program. Everything is built around that frame.
Reworking your code like this is known as “refactoring”, ie improving it without changing what it does.
Leave a Comment