+
     BiW                         R t ^ RI5  ! R R]4      t ! R R]4      tR tR tR t]	R	8X  d   ]! 4       t
]! ]
4       ]! 4        R
# R
# )aN  turtledemo/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()
)*c                   &   a  ] tR t^t o R tRtV tR# )Discc                    \         P                  V R RR7       V P                  4        V P                  RVR,          ^4       V P	                  VR,          ^ ^VR,          ,
          4       V P                  4        R# )squareF)shapevisibleg      ?g      @N)Turtle__init__pu	shapesize	fillcolorst)selfns   &&//usr/lib/python3.14/turtledemo/minimal_hanoi.pyr
   Disc.__init__   sV    He<	sAcE1%qtQ!B$'	     N)__name__
__module____qualname____firstlineno__r
   __static_attributes____classdictcell____classdict__s   @r   r   r      s      r   r   c                   6   a  ] tR t^t o RtR tR tR tRtV t	R# )Towerz-Hanoi tower, a subclass of built-in type listc                    Wn         R# )z-create an empty tower. x is x-position of pegNx)r   r!   s   &&r   r
   Tower.__init__   s    r   c                    VP                  V P                  4       VP                  R^"\        V 4      ,          ,           4       V P	                  V4       R# )   Nij)setxr!   setylenappendr   ds   &&r   push
Tower.push   s5    	tvv	tBs4yL !Ar   c                R    \         P                  V 4      pVP                  ^4       V# )r$   )listpopr&   r)   s   & r   r/   	Tower.pop!   s    HHTN	sr   r    N)
r   r   r   r   __doc__r
   r+   r/   r   r   r   s   @r   r   r      s     3 r   r   c                     V ^ 8  dJ   \        V ^,
          WV4       VP                  VP                  4       4       \        V ^,
          W!V4       R# R# )    N)hanoir+   r/   )r   from_with_to_s   &&&&r   r4   r4   &   s@    1uac5u%ac5% r   c                      \        R R4       \        4         \        ^\        \        \
        4       \        RRRR7       R #   \         d     R # i ; i)Nspacezpress STOP button to exitcenteralignfontCourier   bold)onkeyclearr4   t1t2t3write
Terminatorr   r   r   playrI   ,   sG    	$w	GaR)#:	< s   (A AAc                  <   \        4        \        4        \        ^ R4       \        R4      s\        ^ 4      s\        ^4      s\        ^^ R4       F!  p \        P                  \        V 4      4       K#  	  \        RRR	R7       \        \        R4       \        4        R# )
r3   zpress spacebar to start gamer:   r;   r9   	EVENTLOOPiir>   )htpenupgotor   rD   rE   rF   ranger+   r   rG   rB   rI   listen)is    r   mainrS   6   su    D%'44=	tB	qB	sB1Qr]
Q  

(68	$
Hr   __main__N)r1   turtler	   r   r.   r   r4   rI   rS   r   msgprintmainloopr   r   r   <module>rY      sX    6 D &  Z
&C	#JJ r   