Let's understand what we just did: write a program.
Every program has exactly one program: a section of the code which declares the commands (actions) that we want the computer to execute on the initial board. By executing a program, we get a final board.
The syntax of a program
is really simple:
program
, followed by an opening key: {
}
Some examples of program
s:
program {
}
(makes nothing)
program {
Move(North)
}
(moves the head one position to the north)
program {
Move(North)
Move(North)
}
(moves the head two positions to the north)
Knowing this, write a program which, on a 2x4 board with the head in the initial point (the left bottom cell), moves the head three times to the north.
Inicial | Final | |
---|---|---|
|
|
You must sign in before submitting your solutions