ʏndZddlmZmZddlmZdZdZdZ e dk(re Z e e eyy) 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#(K|dkDrg}|D]g}|j||j}|j||j||j ||j |it |||z||D]}dyyw)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/python312/lib64/python3.12/turtledemo/tree.pyr r s  1uA IIaL A FF1I GGAJ JJqM JJqM c1Q31%AJ& sBBclt}|jd|j|jd|j j dd|j d|j|jd|jt|gddd}|D]}y)NrZi.Agffffff?) r setundobuffer hideturtlespeed getscreentracerr penuprpendownr )rtrs rmaketreer$'sAOODLLNGGAJKKMAFF2JGGIIIdOIIK aS#r6"A  cNt}tt}d||z zS)Nzdone: %.2f sec.)clockr$)rbs rmainr)5s$ gA J gA ! $$r%__main__N) __doc__turtlerrtimerr'r r$r)__name__msgprintr%rr2sC $&$  %  z &C #J Jr%