B
    ^ Çcy  ã               @   sX   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rTe	ƒ Zeeƒ eƒ  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   sz   |dkrvg }xF| D ]>}|  |¡ | ¡ }| |¡ | |¡ | |¡ | |¡ qW x t||| ||ƒD ]
}dV  qhW 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   ú lib/python3.7/turtledemo/tree.pyr
      s    




r
   c              C   sx   t ƒ } |  d ¡ |  ¡  |  d¡ |  ¡  dd¡ |  d¡ |  ¡  |  d¡ |  	¡  t
| gdddƒ}x|D ]}qlW d 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   Ztimer   r   r
   r   r   Ú__name__ÚmsgÚprintr   r   r   r   Ú<module>   s   