Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/turtledemo/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/turtledemo/__pycache__/fractalcurves.cpython-35.opt-1.pyc



��Yf�
�@srdZddlTddlmZmZGdd�de�Zdd�Zedkrne�Z	e
e	�e�d	S)
a&      turtle-example-suite:

        tdemo_fractalCurves.py

This program draws two fractal-curve-designs:
(1) A hilbert curve (in a box)
(2) A combination of Koch-curves.

The CurvesTurtle class and the fractal-curve-
methods are taken from the PythonCard example
scripts for turtle-graphics.
�)�*)�sleep�clockc@s4eZdZdd�Zdd�Zdd�ZdS)�CurvesTurtlecCs�|dkrdS|j|d�|j||d|�|j|�|j|d�|j||d|�|j|�|j||d|�|j|d�|j|�|j||d|�|j|d�dS)Nr�Z�)�left�hilbertZforward�right)�self�size�levelZparity�r�=/opt/alt/python35/lib64/python3.5/turtledemo/fractalcurves.pyr	s


zCurvesTurtle.hilbertcCs�ddl}d||j|j|�}|j�|j|�|j�|jdd|d|�x8t|�D]*}|j|||�|jd|�quW|j	dd|d|�|j�|j
|�|j�dS)Nr��rih)�mathZsinZpi�pu�fd�pd�rt�range�fractal�ltZbk)r�nZradZlev�dirrZedge�irrr�
fractalgon/s




zCurvesTurtle.fractalgoncCs�|dkr|j|�dS|j|d|d|�|jd|�|j|d|d|�|jd|�|j|d|d|�|jd|�|j|d|d|�dS)Nr��<�x)rrrr)rZdistZdepthrrrrrBs
zCurvesTurtle.fractalN)�__name__�
__module__�__qualname__r	rrrrrrrsrcCsyt�}|j�|jd�|j�|j�jdd�|j�d}|jd|d|�|j�t	�}|j
d�|j�|j|�|j
|dd�|j|�x:td�D],}|jd�|j|d	|d
�q�W|j�x.td
�D] }|j|�|jd�qW|j�x:td�D],}|j|d|d
�|jd�qNW|j�t	�}d
||}td�|j�|jd�|j�|j�jdd�t	�}|jdd�|j�|jdddd�|j�|j�|jd�|jdddd�|j�t	�}|d||7}|S)Nrr��!� Zredrr�@r��BzHilbert: %.2fsec. ZblackZblue���zKoch: %.2fsec.i���i�����)r�resetZspeedZhtZ	getscreenZtracerrZsetposrrZ	fillcolorZ
begin_fillrr	rrrZend_fillrZcolorr)ZftrZtar�tb�resrrr�mainNs\	




	








	



	




	r0�__main__N)�__doc__ZturtleZtimerrZPenrr0r!�msg�printZmainlooprrrr�<module>
s
=9