Your IP : 216.73.216.213


Current Path : /proc/242857/root/opt/alt/python34/lib64/python3.4/turtledemo/__pycache__/
Upload File :
Current File : //proc/242857/root/opt/alt/python34/lib64/python3.4/turtledemo/__pycache__/forest.cpython-34.pyo

�
h f��@s�dZddlmZmZmZmZddlmZddlm	Z	dd�Z
dd�Zd	d
�Zddd
d�Z
dd�Zdd�Zdd�Zdd�Zdd�Zedkr�e�e�ndS)a4     turtlegraphics-example-suite:

             tdemo_forest.py

Displays a 'forest' of 3 breadth-first-trees
similar to the one in tree.
For further remarks see tree.py

This example is a 'breadth-first'-rewrite of
a Logo program written by Erich Neuwirth. See
http://homepage.univie.ac.at/erich.neuwirth/
�)�Turtle�	colormode�tracer�mainloop)�	randrange)�clockcCst||d�S)N�)r)�n�r
�6/opt/alt/python34/lib64/python3.4/turtledemo/forest.py�	symRandomsrcs��fdd�|D�S)Ncs:g|]0\}}|t��|dt��f�qS)g)\��(�?)r)�.0�angle�
sizefactor)�	angledist�sizedistr
r�
<listcomp>s	zrandomize.<locals>.<listcomp>r
)�
branchlistrrr
)rrr�	randomizesrcCsCx<t|�D].}|jt|��|jd||�q
WdS)Ng�?)�range�leftrZforward)�tZdistance�partsr�ir
r
r�randomfdsr�
�ccsF|dkrBg}g}x�tt||��D]�\}	}
|	j||�|	jddd|td�dd|td�d�|	j�t|	|||�dVxZ|
D]R\}}|	j|�|j|	j	��|jt
|
||��|	j|�q�Wq.Wx6t||||d||||�D]}
dVq0WndS)Nr����r)
�list�zipZpensizeZpencolorr�pendownrr�appendZcloner�right�tree)Ztlist�size�levelZwidthfactorZbranchlistsrrZlstZbrsrrrr�xr
r
rr&s&"

r&cCs`td�|j�|jd�|j�|jd�|j�|j||�|j�dS)Nrr�Z)r�resetZspeed�
hideturtlerZpenupZsetposr#)rr)�yr
r
r�start7s





r.c	CsE|j�t|dd
�t|gd|ddddgg�}|S)N����Pg�������?�-��G�z�?r��������?���Q��?i0���)r2r3)rr4����)r6r5)r,r.r&)r(�penrr
r
r�doit1As
'r8cCsB|j�t|dd	�t|gd|dd
dgg�}|S)
N���xg�������?r2��G�z�?���Q��?iy���i~���)r2r<����)r>r=)r,r.r&)r(r7rr
r
r�doit2Gs
$r?c	CsE|j�t|dd
�t|gd|ddddgg�}|S)N�r*�dg�������?r2�ffffff�?r�
ףp=
�?��������?i����)r2rB)rrC����)rErD)r,r.r&)r(r7rr
r
r�doit3Ms
'rFc
Cs�t�}|j�tdd�tdtdd��}tdtdd��}tdtdd��}t�}xWd}x:|||fD])}y|j�Wq�|d7}Yq�Xq�W|dkrtPqtqtWtdd	�t�}d
||S)N�Kr�Zundobuffersizer�r�rzruntime: %.2f sec.)rZhtrr8r?rFr�__next__)�p�u�sr�a�done�br
r
r�mainTs&	

	
	rR�__main__N)�__doc__ZturtlerrrrZrandomrZtimerrrrr&r.r8r?rFrR�__name__r
r
r
r�<module>
s"