2 """ turtle-example-suite:
6 Displays a 'breadth-first-tree' - in contrast
7 to the classical Logo tree drawing programs,
8 which use a depth-first-algorithm.
11 (1) a tree-generator, where the drawing is
12 quasi the side-effect, whereas the generator
14 (2) Turtle-cloning: At each branching point the
15 current pen is cloned. So in the end there
18 from turtle
import Turtle
, mainloop
19 from time
import clock
21 def tree(plist
, l
, a
, f
):
22 """ plist is list of pens
24 a is half of the angle between 2 branches
25 f is factor by which branch is shortened
26 from level to level."""
36 for x
in tree(lst
, l
*f
, a
, f
):
49 t
= tree([p
], 200, 65, 0.6375)
52 print len(p
.getscreen().turtles())
58 return "done: %.2f sec." % (b
-a
)
60 if __name__
== "__main__":