of9o+dZddlmZmZddlmZdZdZdZ e dkr!e Z e e edSdS) a turtle-example-suite: tdemo_tree.py Displays a 'breadth-first-tree' - in contrast to the classical Logo tree drawing programs, which use a depth-first-algorithm. Uses: (1) a tree-generator, where the drawing is quasi the side-effect, whereas the generator always yields None. (2) Turtle-cloning: At each branching point the current pen is cloned. So in the end there are 1024 turtles. )Turtlemainloop) perf_counterc#ZK|dkrg}|D]}|||}||||||||t |||z||D]}dVdSdS)z 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.N)forwardcloneleftrightappendtree)plistlaflstpqxs 6/opt/alt/python311/lib64/python3.11/turtledemo/tree.pyr r s  1uu  A IIaLLL A FF1III GGAJJJ JJqMMM JJqMMMMc1Q31%%  AJJJJ u  ct}|d||d|dd|d||d| t|gddd}|D]}dS)NrZi.Agffffff?) r setundobuffer hideturtlespeed getscreentracerr penuprpendownr )rtrs rmaketreer%'sAOODLLNNNGGAJJJKKMMAFF2JJJGGIIIIIdOOOIIKKK aS#r6""A      rcft}tt}d||z zS)Nzdone: %.2f sec.)clockr%)rbs rmainr)5s, ggA JJJ ggA ! $$r__main__N) __doc__turtlerrtimerr'r r%r)__name__msgprintrrr2s $#######&&&&&&$    %%%  z $&&C E#JJJ HJJJJJr