com.lrdev.turtle
Java Turtle code.
[applets (scaled, centered)]
Turtle code for the pentagons and heptagons above:
repeat 5 [forward 20 repeat 0 [right 360/5] forward 20 repeat 1 [left 360/5]]
repeat 5 [forward 20 repeat 1 [right 360/5] forward 20 repeat 2 [left 360/5]]
repeat 7 [forward 20 repeat 0 [right 360/7] forward 20 repeat 1 [left 360/7]]
repeat 7 [forward 20 repeat 1 [right 360/7] forward 20 repeat 2 [left 360/7]]
repeat 7 [forward 20 repeat 2 [right 360/7] forward 20 repeat 3 [left 360/7]]
The first expression
can of course be expressed in a simpler way as
"repeat 5 [forward 40 left 72]"
.
The former has been chosen to preserve symmetry in the generating expressions.
[applet]
Get the focus on the applet [possibly by clicking the applet above with the pointing device], then type for interactive usage:
fL+
repeated 36 times
[larger]
[applet]
Get the focus on the applet [possibly by clicking the applet above with the pointing device], then type for interactive usage: