These examples are very simple and easy to understand. This perfectly fit for a first approach to programming for students.
Listing #1 : Simply moving the robot
function Voxel_Step()
{
Move(0);
}
Listing #2 : Square displacement
Direction <- 0;
function Voxel_Step()
{
Move(Direction);
Direction = Direction + 1;
if (Direction >= 4) Direction = 0;
}
Listing #3 : Big square displacement
Direction <- 0;
Step <- 0;
function Voxel_Step()
{
Move(Direction);
Step = Step + 1;
if (Step > 5)
{
Step = 0;
Direction = Direction + 1;
if (Direction >= 4) Direction = 0;
}
}