I wrote the Mars Rover navigation game to demonstrate programming concepts for a recent career day presentation.
- R – Turn the Rover 90 degrees to the right.
- L – Turn the Rover 90 degrees to the left.
- M – Move one square in the direction that the Rover is currently facing.
Enter the program into the text window on the right of the screen using only the R, L, or M commands, e.g. “MMML” will move the rover three squares and then turn the Rover 90 degrees to the left. When you’re confident that you have the program ready, test it by clicking the “Transmit” button. If you reach the goal, the message “Mission Success” will be displayed, otherwise “Mission Failure” will appear. Click “Reset” to clear the program window and reset the Rover’s position so that you can try again.
As an added benefit, this game also helps to illustrate the concept of debugging, since you may not accomplish the mission on the first attempt.
The source code for this project is maintained on GitHub.