Your IP : 18.219.202.234
�
Afc@smdZddlTddlmZmZdefd��YZd�Zedkrie�Z e GHe
�ndS( s& 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.
i����(t*(tsleeptclocktCurvesTurtlecBs#eZd�Zd�Zd�ZRS(cCs�|dkrdS|j|d�|j||d|�|j|�|j|d�|j||d|�|j|�|j||d|�|j|d�|j|�|j||d|�|j|d�dS(NiiZi(tleftthilberttforwardtright(tselftsizetleveltparity((s7/usr/lib64/python2.7/Demo/turtle/tdemo_fractalcurves.pyRs
cCs�ddl}d||j|j|�}|j�|j|�|j�|jdd|d|�x8t|�D]*}|j|||�|jd|�quW|j dd|d|�|j�|j
|�|j�dS(Ni����ii�iZih(tmathtsintpitputfdtpdtrttrangetfractaltlttbk(RtntradtlevtdirRtedgeti((s7/usr/lib64/python2.7/Demo/turtle/tdemo_fractalcurves.pyt
fractalgon/s
cCs�|dkr|j|�dS|j|d|d|�|jd|�|j|d|d|�|jd|�|j|d|d|�|jd|�|j|d|d|�dS(Niii<ix(RRRR(RtdisttdepthR((s7/usr/lib64/python2.7/Demo/turtle/tdemo_fractalcurves.pyRBs
(t__name__t
__module__RRR(((s7/usr/lib64/python2.7/Demo/turtle/tdemo_fractalcurves.pyRs cCsrt�}|j�|jd�|j�|jdd�|j�d}|jd|d|�|j�t�}|j d�|j
t�|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�qKW|j
t�t�}d
||}td�|j�|jd�|j�|jdd�t�}|jdd�|j
t�|jdddd�|j
t�|jd�|jdddd�|j
t�t�}|d||7}|S(Niiii���i��trediiZi@iiiBsHilbert: %.2fsec. tblacktbluei�i�i����sKoch: %.2fsec.(RtresettspeedthtttracerRtsetposRRt fillcolortfilltTrueRRRRRtFalseRtcolorR(tftR ttaRttbtres((s7/usr/lib64/python2.7/Demo/turtle/tdemo_fractalcurves.pytmainNsZ
t__main__N(t__doc__tturtlettimeRRtPenRR3R tmsgtmainloop(((s7/usr/lib64/python2.7/Demo/turtle/tdemo_fractalcurves.pyt<module>
s
= 8
?>