Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/turtledemo/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/turtledemo/__pycache__/minimal_hanoi.cpython-312.opt-1.pyc

�

&Μg���dZddl�Gd�de�ZGd�de�Zd�Zd�Zd	�Ze	d
k(re�Z
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
 ---------------------------------------
�)�*c��eZdZd�Zy)�Discc���tj|dd��|j�|jd|dzd�|j	|dzdd|dzz
�|j�y)	N�squareF)�shape�visibleg�?�g@r�)�Turtle�__init__�pu�	shapesize�	fillcolor�st)�self�ns  �5/usr/local/lib/python3.12/turtledemo/minimal_hanoi.pyr
z
Disc.__init__sV������H�e��<����	����s�A�c�E�1�%����q��t�Q��!�B�$��'����	�N)�__name__�
__module__�__qualname__r
�rrrrs��rrc�"�eZdZdZd�Zd�Zd�Zy)�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����")�setxr�sety�len�append�r�ds  r�pushz
Tower.push#s5��	���t�v�v��	���t�B�s�4�y�L� �!����A�rc�R�tj|�}|jd�|S)N�)�list�popr!r$s  rr*z	Tower.pop's���H�H�T�N��	���s���rN)rrr�__doc__r
r&r*rrrrrs��3���rrc��|dkDrBt|dz
|||�|j|j��t|dz
|||�yy)Nrr)�hanoir&r*)r�from_�with_�to_s    rr-r-,sD���1�u�
�a��c�5�#�u�%���������
�a��c�5�%��%�
rc��tdd�t�	tdttt
�t
ddd��y#t$rYywxYw)N�space�zpress STOP button to exit�center��Courier��bold��align�font)�onkey�clearr-�t1�t2�t3�write�
Terminatorrrr�playrC2sG��	�$�w��	�G�
�
�a��R���
�)��#:�	<���
��
�s�(A�	A
�A
c�6�t�t�tdd�td�atd�atd�atddd�D] }tjt|���"tddd	�
�ttd�t�y)
Nri���i����r3���zpress spacebar to start gamer4r5r9r2�	EVENTLOOP)�ht�penup�gotorr>r?r@�ranger&rrAr<rC�listen)�is r�mainrN<su���D�%�'�4��4�=�	�t��B�	�q��B�	�s��B�
�1�Q�r�]��
����Q����
�
(��6�8�	�$���
�H�r�__main__N)
r+�turtlerrr)rr-rCrNr�msg�print�mainlooprrr�<module>rTsX���$��6���D��&�
�� �Z��
�&�C�	�#�J��J�r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists