GroIMP Module XL English
Spoken text
The turtle commands for branching are two square brackets. Once an opening bracket appears in the character sequence, the current state of the turtle is saved – so put on top of a stack – and the commands inside the brackets will be executed and interpreted. After closing the square brackets, the uppermost state is retrieved from the stack and set again as the current state of the turtle. Thus, the turtle jumps back to the position before the branch.
This simple example shows the branching very well. After drawing the cylinder of length 1, two branches are drawn, which could basically symbolize an opposite shoot growth. The inclination of the second branch can be specified with either +315 or -45 degrees.
When you insert another cylinder between the two branches, an alternate growth can be represented.
Of cause new branches can also be created within branches.