python (3.12.0)

(root)/
lib/
python3.12/
turtledemo/
__pycache__/
minimal_hanoi.cpython-312.pyc

̑edZddlGddeZGddeZdZdZd	Ze	d
k(reZ
ee
eyy)a       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
 ---------------------------------------
)*ceZdZdZy)Discctj|dd|j|jd|dzd|j	|dzdd|dzz
|jy)	NsquareF)shapevisibleg?g@r)Turtle__init__pu	shapesize	fillcolorst)selfns  L/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/turtledemo/minimal_hanoi.pyr
z
Disc.__init__sVHe<	sAcE1%qtQ!B$'	N)__name__
__module____qualname__r
rrrrsrrc"eZdZdZdZdZdZy)Towerz-Hanoi tower, a subclass of built-in type listc||_y)z-create an empty tower. x is x-position of pegN)x)rrs  rr
zTower.__init__ s	rc|j|j|jddt|zz|j	|y)Nij")setxrsetylenappendrds  rpushz
Tower.push#s5	tvv	tBs4yL !ArcRtj|}|jd|S)N)listpopr!r$s  rr*z	Tower.pop'sHHTN	srN)rrr__doc__r
r&r*rrrrrs3rrc|dkDrBt|dz
||||j|jt|dz
|||yy)Nrr)hanoir&r*)rfrom_with_to_s    rr-r-,sD1u
ac5#u%
ac5%%
rctddt	tdttt
t
dddy#t$rYywxYw)Nspacezpress STOP button to exitcenterCourierboldalignfont)onkeyclearr-t1t2t3write
TerminatorrrrplayrC2sG	$w	G

aR
)#:	<

s(A	A
A
c6tttddtdatdatdatdddD] }tjt|"tddd	
ttdty)
Nriir3zpress spacebar to start gamer4r5r9r2	EVENTLOOP)htpenupgotorr>r?r@ranger&rrAr<rClisten)is rmainrN<szD%'44=	tB	qB	sB
1Qr]
Q

(68	$
Hr__main__N)
r+turtlerrr)rr-rCrNrmsgprintmainlooprrr<module>rTsX$6D&
 Z
&C	#JJr