First program

As mentioned previously, there are two main windows used to interact with Reeborg. To the left is a program window; this is where you write the instructions for Reeborg to follow. To the right is the actual "graphical world" window in which Reeborg moves according to the instructions received.

Click on the Open Program button open program button and select the file "move1.rur". You should see the following computer code, or code for short, appear in the program window.

move()
turn_off()
The word code is synonymous with "program text". A program is a series of instructions. In this case, the code consists of two instructions:

Reeborg recognizes instructions as commands that he must obey by the presence of two parentheses () which follow the words making up the instructions.

Now, click on the run program button button and watch Reeborg move in his world.

Your turn

Change the program by adding a second move() instruction as follows:

move()
move()
turn_off()
Click on the Save button save program button and give it the name "move2" (the program will automatically add the ".rur" extension). Congratulations! You have just created your first program. Now, ask Reeborg to execute or to run the program by clicking on the run program button button.

Experiment!

You can ask Reeborg to take more than two steps. What happens if you ask Reeborg to take so many steps that he has to move beyond the world boundary? In particular, look at the program window; you should have noticed by now that instructions are highlighted as they are being executed by Reeborg.

previous Reeborg explore its world; - home - Dealing with eRRoRs next
../images/SourceForge.net Logo