ó 6”þfc@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*(tsleeptclockt CurvesTurtlecBs#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(RtntradtlevtdirR tedgeti((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 ƒ|jddd dƒ|j t ƒ|jdƒ|jddd dƒ|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 s = 8