Pattern: | |
Steps: | |
This program follows the principle of "three rights make a left". The "ant" initially starts out oriented upwards. An 'R' will make it turn right, then move 'forward' (right on the screen) one space, after which it will be oriented to the right. Another 'R' will make it turn right again, then move 'forward' (down on the screen) one more space. Four 'R's or 'L's will make a square and leave the "ant" oriented in the same direction it started at.
The ant will move the specified number of times, or "steps". If there are less directions (letters) in the sequence than there are number of steps, then the ant will repeat the sequence given until it has reached the specified number of steps.
Note: any characters that are not 'R' or 'L' will be removed from the pattern sequence before it's drawn.
Sequence | Description |
---|---|
RLL | Plus sign |
RRLL | Snake |
RRRLL | 5 pips |