ó 6”þfc@sdZddlTdefd„ƒYZdefd„ƒYZd„Zd„Zd „Ze d kr{eƒZ e GHe ƒnd S( sã turtle-example-suite: tdemo_minimal_hanoi.py A minimal 'Towers of Hanoi' animation: A tower of 6 discs is transferred from the left to the right peg. An imho quite elegant and concise implementation using a tower class, which is derived from the built-in type list. Discs are turtles with shape "square", but stretched to rectangles by shapesize() --------------------------------------- To exit press STOP button --------------------------------------- iÿÿÿÿ(t*tDisccBseZd„ZRS(cCsgtj|dddtƒ|jƒ|jd|ddƒ|j|ddd|dƒ|jƒdS( Ntshapetsquaretvisiblegø?ig@ii(tTurtlet__init__tFalsetput shapesizet fillcolortst(tselftn((s7/usr/lib64/python2.7/Demo/turtle/tdemo_minimal_hanoi.pyRs  (t__name__t __module__R(((s7/usr/lib64/python2.7/Demo/turtle/tdemo_minimal_hanoi.pyRstTowercBs)eZdZd„Zd„Zd„ZRS(s-Hanoi tower, a subclass of built-in type listcCs ||_dS(s-create an empty tower. x is x-position of pegN(tx(R R((s7/usr/lib64/python2.7/Demo/turtle/tdemo_minimal_hanoi.pyR scCs<|j|jƒ|jddt|ƒƒ|j|ƒdS(Nijÿÿÿi"(tsetxRtsetytlentappend(R td((s7/usr/lib64/python2.7/Demo/turtle/tdemo_minimal_hanoi.pytpush#scCs tj|ƒ}|jdƒ|S(Ni–(tlisttpopR(R R((s7/usr/lib64/python2.7/Demo/turtle/tdemo_minimal_hanoi.pyR's (RRt__doc__RRR(((s7/usr/lib64/python2.7/Demo/turtle/tdemo_minimal_hanoi.pyRs  cCsT|dkrPt|d|||ƒ|j|jƒƒt|d|||ƒndS(Nii(thanoiRR(R tfrom_twith_tto_((s7/usr/lib64/python2.7/Demo/turtle/tdemo_minimal_hanoi.pyR,s cCsAtddƒtƒtdtttƒtddddd ƒdS( Ntspaceispress STOP button to exittaligntcentertfonttCourieritbold(R#iR$(tonkeytNonetclearRtt1tt2tt3twrite(((s7/usr/lib64/python2.7/Demo/turtle/tdemo_minimal_hanoi.pytplay2s   cCstƒtƒtddƒtdƒatdƒatdƒax-tdddƒD]}tjt |ƒƒqRWt ddd d dƒt t dƒt ƒdS(Niiÿÿÿiÿÿÿiúiiÿÿÿÿspress spacebar to start gameR R!R"R#iR$Rt EVENTLOOP(sCourierisbold(thttpenuptgotoRR(R)R*trangeRRR+R%R,tlisten(ti((s7/usr/lib64/python2.7/Demo/turtle/tdemo_minimal_hanoi.pytmain9s       t__main__N( RtturtleRRRRRR,R4Rtmsgtmainloop(((s7/usr/lib64/python2.7/Demo/turtle/tdemo_minimal_hanoi.pyts