As we explained in the square example, we can start making differences between two types of commands inside a program:
Move
, Drop
and Grab
. We call them primitive commands, or simply primitive;
When creating a procedure, we “teach” the computer to carry out a new task, which wasn't originally included in the language.
It would be impossible to write a language that includes EVERYTHING that we may want to do, wouldn't it?
Now it's your turn: write a procedure
Drop3Green
which drops 3 green stones in the current cell and aprogram
which uses it.
If you don't know how to start, copy the code of the previous exercise and modify the parts you consider necessary.
procedure DrawBlackSquareSide3() {
Drop(Black)
Move(East)
Drop(Black)
Move(East)
Drop(Black)
Move(North)
Drop(Black)
Move(West)
Drop(Black)
Move(West)
Drop(Black)
Move(North)
Drop(Black)
Move(East)
Drop(Black)
Move(East)
Drop(Black)
}
program {
DrawBlackSquareSide3()
}
You must sign in before submitting your solutions