Lightbot

Solve Puzzles using Programming!

LightBot is a puzzle game based on coding; it secretly teaches you programming logic as you play!

Programming, or Coding, is simply the way people tell a computer what to do using instructions that the computer understands.

Rules for Programming Lightbot

In the game, the Lightbot is programmed by arranging icons representing discrete actions onto a grid. The possible actions are:

forward    light    left     right     jump      P1        P2
  • forward - Lightbot moves forward one step if this does not take it off the grid and the next tile is at the same level as the current tile.
  • light - Lightbot lights up the tile it is standing on if it has a deep blue color.
  • left - Lightbot turns left (counter-clockwise) 90 degrees but stays on the current tile.
  • right - Lightbot turns right (clockwise) 90 degrees but stays on the current tile.
  • jump - Lightbot jumps forward one step if the next tile is either one level higher or any number of levels lower than the current tile.
  • P1 - Lightbot starts executing the commands shown in the PROC1 area. Once it is done, it returns back to where it left off in the command sequence (just after the P1 command).
  • P2 - Lightbot starts executing the commands shown in the PROC2 area. Once it is done, it returns back to where it left off in the command sequence (just after the P2 command).

Representing Lightbot Programs Textually

Although programs can be written in a variety of notations — including graphical ones, like in the Light-Bot game — it is most common to use represent programs textually.

For example, consider the Lightbot puzzle with its solution program and the corresponding text file shown in Figure 1 below.

Name: Larry Xu
Stage: 5-1

MAIN:
  P1

PROC1:
  forward
  right if green
  light
  P1
                    

Figure 1 A Lightbot game solution and its corresponding text file

Check the format of your Lightbot file

NOTE: The checker tool does not check to see if your answer is correct. Instead, it only checks to see if you've formatted your file correctly based on the rules given above.
lightbot format checker

Good luck in your future coding endeavours!

You can now go on and learn another programming language that can tell a computer to do other, more complex and cool things. You can apply the knowledge of what programming is and how things like Commands, Procedures and Loops work.