Mini Shell

Direktori : /opt/cppython/lib/python3.8/turtledemo/__pycache__/
Upload File :
Current File : //opt/cppython/lib/python3.8/turtledemo/__pycache__/forest.cpython-38.pyc

U

��eg��@s�dZddlmZmZmZmZddlmZddlm	Z
dd�Zdd�Zd	d
�Z
dd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zedkr�e�e�dS)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)�perf_countercCst||d�S)N�r)�n�r�0/opt/cppython/lib/python3.8/turtledemo/forest.py�	symRandomsr
cs��fdd�|D�S)Ncs,g|]$\}}|t��|dt��f�qS)g)\��(�?)r
)�.0�angle�
sizefactor��	angledist�sizedistrr�
<listcomp>s�
�zrandomize.<locals>.<listcomp>r)�
branchlistrrrrr�	randomizes�rcCs2t|�D]$}|�t|��|�d||�qdS)Ng�?)�range�leftr
Zforward)�tZdistance�partsr�irrr�randomfdsr�
�ccs�|dkr�g}g}tt||��D]�\}	}
|	�||�|	�ddd|td�dd|td�d�|	��t|	|||�dV|
D]<\}}|	�|�|�|	�	��|�t
|
||��|	�|�q�qt||||d||||�D]
}
dVq�dS)Nr����r	)
�list�zipZpensizeZpencolorr
�pendownrr�appendZcloner�right�tree)Ztlist�size�levelZwidthfactorZbranchlistsrrZlstZbrsrrrr�xrrrr(s,�
�r(cCsLtd�|��|�d�|��|�d�|��|�||�|��dS)Nrr�Z)r�resetZspeed�
hideturtlerZpenupZsetposr%)rr+�yrrr�start7s

r0cCs2|��t|dd�t|gd|ddddgg�}|S)N�i0����P皙�����?��-g�G�z�?)r��������?�����g���Q��?�r.r0r(�r*Zpenrrrr�doit1Asr;cCs0|��t|dd�t|gd|dddgg�}|S)Niy���i~����xr3r4r7r9r:rrr�doit2Gsr=cCs2|��t|dd�t|gd|ddddgg�}|S)N�i�����dr3)r5gffffff�?)rg
ףp=
�?)r8r6r9r:rrr�doit3Msr@cCs�t�}|��tdd�tdtdd��}tdtdd��}tdtdd��}t�}d}|||fD]&}z|��Wq\|d7}Yq\Xq\|dkrNq�qNtdd	�t�}d
||S)N�Kr�r	)Zundobuffersize�r�rzruntime: %.2f sec.)rZhtrr;r=r@�clock�__next__)�p�u�sr�a�done�brrr�mainTs$

rM�__main__N)rr)�__doc__Zturtlerrrr�randomr�timerrEr
rrr(r0r;r=r@rM�__name__rrrr�<module>s



Zerion Mini Shell 1.0