o
    FXîhy  ã                   @   s\   d Z ddlmZmZ ddlmZ dd„ Zdd„ Zdd	„ Z	e
d
kr,e	ƒ Zeeƒ eƒ  dS dS )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.
é    )ÚTurtleÚmainloop)Úperf_counterc                 c   sx    |dkr8g }| D ]}|  |¡ | ¡ }| |¡ | |¡ | |¡ | |¡ q	t||| ||ƒD ]}dV  q2dS dS )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)ÚforwardZcloneÚleftÚrightÚappendÚtree)ZplistÚlÚaÚfZlstÚpÚqÚx© r   ú9/opt/python-3.10.19/usr/lib/python3.10/turtledemo/tree.pyr
      s   €



ö	r
   c                  C   st   t ƒ } |  d ¡ |  ¡  |  d¡ |  ¡  dd¡ |  d¡ |  ¡  |  d¡ |  	¡  t
| gdddƒ}|D ]}q5d S )Nr   é   éZ   i.ÿÿÿéÈ   éA   gffffffä?)r   ZsetundobufferZ
hideturtleZspeedZ	getscreenZtracerr   Zpenupr   Zpendownr
   )r   Útr   r   r   r   Úmaketree'   s   



ÿr   c                  C   s   t ƒ } tƒ  t ƒ }d||   S )Nzdone: %.2f sec.)Úclockr   )r   Úbr   r   r   Úmain5   s   r   Ú__main__N)Ú__doc__Zturtler   r   Útimer   r   r
   r   r   Ú__name__ÚmsgÚprintr   r   r   r   Ú<module>   s   
ý