MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / tree

Function tree

tools/python-3.11.9-amd64/Lib/turtledemo/tree.py:21–37  ·  view source on GitHub ↗

plist is list of pens l is length of branch a is half of the angle between 2 branches f is factor by which branch is shortened from level to level.

(plist, l, a, f)

Source from the content-addressed store, hash-verified

19from time import perf_counter as clock
20
21def tree(plist, l, a, f):
22 """ plist is list of pens
23 l is length of branch
24 a is half of the angle between 2 branches
25 f is factor by which branch is shortened
26 from level to level."""
27 if l > 3:
28 lst = []
29 for p in plist:
30 p.forward(l)
31 q = p.clone()
32 p.left(a)
33 q.right(a)
34 lst.append(p)
35 lst.append(q)
36 for x in tree(lst, l*f, a, f):
37 yield None
38
39def maketree():
40 p = Turtle()

Callers 1

maketreeFunction · 0.70

Calls 5

forwardMethod · 0.45
cloneMethod · 0.45
leftMethod · 0.45
rightMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected