Your IP : 216.73.216.166
U
e5d��@sXdZddlmZmZddlmZGdd�de�Zdd�Ze dkrTe�Z
ee
�e�d S)
a� turtle-example-suite:
tdemo_bytedesign.py
An example adapted from the example-suite
of PythonCard's turtle graphics.
It's based on an article in BYTE magazine
Problem Solving with Logo: Using Turtle
Graphics to Redraw a Design
November 1982, p. 118 - 134
-------------------------------------------
Due to the statement
t.delay(0)
in line 152, which sets the animation delay
to 0, this animation runs in "line per line"
mode as fast as possible.
�)�Turtle�mainloop)�perf_counterc@sTeZdZdd�Zdd�Zdd�Zdd�Zd d
�Zdd�Zd
d�Z dd�Z
dd�ZdS)�DesignercCs�|��td�D]J}|�d|�|��|�|��|�|��|�d|�|�d�q|��|�|�|�d�|�d|�|�d�|��|� d|d|�|�
��d �dS)
N�g�����)P@�H�$g�8@���.g������a@T)�up�range�forward�down�wheel�position�backward�right�goto�centerpiece� getscreen�tracer)�selfZhomePos�scale�i�r�-/usr/lib64/python3.8/turtledemo/bytedesign.py�design s
zDesigner.designcCs�|�d�td�D]}|�||�q|��|�d�td�D]}|�||�q>|�d�td�D]:}|��|�d�|�d|�|��|�d|�qb|�d�|� ��
�dS)N�6�rrr�)rr� pentpiecer�left�tripiecer
rrr�update)r�initposrrrrrr2s
zDesigner.wheelcCs�|��}|��|�d|�|�d||�|��|�|�|�|�|��|�d|�|�d||�|��|�|�|�|�|�d�|� ��
�dS)Ng@g�?@r)�headingrr�tripolyrrr�
setheading�tripolylr!rr#)rr$r�oldhrrrr"Ds
zDesigner.tripiececCs�|��}|��|�d|�|��td�D]}|�d|�|�d�q.|�d|d|�|��|�|�|�|�|�d|�|��td�D]}|�d|�|�d�q�|� d|d|�|��|�|�|�|�|�
d�|����dS)N�r�r�K)
r%rr
rrr�pentrrr'�pentlr!rr#)rr$rr)rrrrr Us,
zDesigner.pentpiececCs>|d|krdS|�|�|�|�|�|d|||�dS�N�gR���Q�?)r
r!r.�r�sideZangrrrrr.ms
zDesigner.pentlcCs>|d|krdS|�|�|�|�|�|d|||�dSr/)r
rr-r1rrrr-ss
zDesigner.pentrcCsh|d|krdS|�|�|�d�|�|d�|�d�|�|d�|�d�|�|d|�dS�Nr�og{�G�z�?g�������?�g�?)r
rr&�rr2rrrrr&ys
zDesigner.tripolyrcCsh|d|krdS|�|�|�d�|�|d�|�d�|�|d�|�d�|�|d|�dSr3)r
r!r(r6rrrr(�s
zDesigner.tripolylcCs>|�|�|�|�|d|kr$dS|�|d|||�dS)Ng@g333333�?)r
r!r)r�s�arrrrr�s
zDesigner.centerpieceN)�__name__�
__module__�__qualname__rrr"r r.r-r&r(rrrrrrs
rcCs\t�}|�d�|��|���d�|���d�t�}|�|��d�t�}d||S)Nrr0zruntime: %.2f sec.) rZspeedZ
hideturtlerZdelayr�clockrr)�tZatZetrrr�main�s
r>�__main__N)�__doc__Zturtlerr�timerr<rr>r9�msg�printrrrr�<module>su
?>