AlkantarClanX12

Your IP : 3.144.122.20


Current Path : /usr/lib64/python3.8/turtledemo/__pycache__/
Upload File :
Current File : //usr/lib64/python3.8/turtledemo/__pycache__/minimal_hanoi.cpython-38.pyc

U

e5d�@sddZddlTGdd�de�ZGdd�de�Zdd�Zd	d
�Zdd�Ze	d
kr`e�Z
ee
�e�dS)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@seZdZdd�ZdS)�DisccCsPtj|ddd�|��|�d|dd�|�|ddd|d�|��dS)	NZsquareF)�shapeZvisibleg�?�g@r�)�Turtle�__init__ZpuZ	shapesizeZ	fillcolor�st)�self�n�r�0/usr/lib64/python3.8/turtledemo/minimal_hanoi.pyrs
z
Disc.__init__N)�__name__�
__module__�__qualname__rrrrr
rsrc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�Towerz-Hanoi tower, a subclass of built-in type listcCs
||_dS)z-create an empty tower. x is x-position of pegN)�x)r
rrrr
r szTower.__init__cCs0|�|j�|�ddt|��|�|�dS)Nij����")Zsetxr�sety�len�append�r
�drrr
�push#sz
Tower.pushcCst�|�}|�d�|S)N�)�list�poprrrrr
r's

z	Tower.popN)rrr�__doc__rrrrrrr
rsrcCs>|dkr:t|d|||�|�|���t|d|||�dS)Nrr)�hanoirr)rZfrom_Zwith_Zto_rrr
r,srcCsJtdd�t�z tdttt�tdddd�Wntk
rDYnXdS)N�space�zpress STOP button to exit�center�ZCourier�Zbold�ZalignZfont)�onkey�clearr�t1�t2�t3�writeZ
Terminatorrrrr
�play2s
�
r+cCspt�t�tdd�td�atd�atd�atddd�D]}t�t	|��q:t
ddd	d
�ttd�t
�dS)
Nri���i����r ���zpress spacebar to start gamer!r"r$rZ	EVENTLOOP)ZhtZpenupZgotorr'r(r)�rangerrr*r%r+Zlisten)�irrr
�main<s
�
r0�__main__N)
rZturtlerrrrrr+r0r�msg�printZmainlooprrrr
�<module>s