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

Function tree

tools/python-3.11.9-amd64/Lib/turtledemo/forest.py:31–52  ·  view source on GitHub ↗
(tlist, size, level, widthfactor, branchlists, angledist=10, sizedist=5)

Source from the content-addressed store, hash-verified

29 t.forward( (1.0 * distance)/parts )
30
31def tree(tlist, size, level, widthfactor, branchlists, angledist=10, sizedist=5):
32 # benutzt Liste von turtles und Liste von Zweiglisten,
33 # fuer jede turtle eine!
34 if level > 0:
35 lst = []
36 brs = []
37 for t, branchlist in list(zip(tlist,branchlists)):
38 t.pensize( size * widthfactor )
39 t.pencolor( 255 - (180 - 11 * level + symRandom(15)),
40 180 - 11 * level + symRandom(15),
41 0 )
42 t.pendown()
43 randomfd(t, size, level, angledist )
44 yield 1
45 for angle, sizefactor in branchlist:
46 t.left(angle)
47 lst.append(t.clone())
48 brs.append(randomize(branchlist, angledist, sizedist))
49 t.right(angle)
50 for x in tree(lst, size*sizefactor, level-1, widthfactor, brs,
51 angledist, sizedist):
52 yield None
53
54
55def start(t,x,y):

Callers 3

doit1Function · 0.70
doit2Function · 0.70
doit3Function · 0.70

Calls 11

listFunction · 0.85
symRandomFunction · 0.85
randomfdFunction · 0.85
pensizeMethod · 0.80
pencolorMethod · 0.80
pendownMethod · 0.80
randomizeFunction · 0.70
leftMethod · 0.45
appendMethod · 0.45
cloneMethod · 0.45
rightMethod · 0.45

Tested by

no test coverage detected