![]() |
Python_2
1.0
|
Towers of Hanoi, Python/Tk style. More...
Functions | |
def | do_hanoi (n) |
def | hanoi (n, ffrom, to, work) |
def | init () |
def | move_ring (n, to) |
def | main () |
Variables | |
list | colors = [] |
int | fly_y = 32 |
int | max_rings = 24 |
int | num_moves = 0 |
dictionary | pole = {} |
dictionary | ring = {} |
int | ring_base = 0 |
int | ring_spacing = 0 |
bool | stopped = False |
bool | single_move = False |
int | velocity = 0 |
mw = Tk() | |
canvas = Canvas() | |
Towers of Hanoi, Python/Tk style.
def _09_tkhanoi.do_hanoi | ( | n | ) |
Initialize for a new simulation. n: number of rings
Referenced by init().
def _09_tkhanoi.hanoi | ( | n, | |
ffrom, | |||
to, | |||
work | |||
) |
Recursively move rings until complete or stopped by the user.
def _09_tkhanoi.init | ( | ) |
References _10_tkmpg123.about(), do_hanoi(), _07_alarme_class.fini(), and _05c_sinx_x.stop().
Referenced by main(), and _12a_poly_interface.mainInterface().
def _09_tkhanoi.main | ( | ) |
Main program.
References init().
def _09_tkhanoi.move_ring | ( | n, | |
to | |||
) |
Move ring n - its bounding box coordinates - to pole to.
References Getch.getch.
_09_tkhanoi.canvas = Canvas() |
list _09_tkhanoi.colors = [] |
int _09_tkhanoi.fly_y = 32 |
int _09_tkhanoi.max_rings = 24 |
_09_tkhanoi.mw = Tk() |
int _09_tkhanoi.num_moves = 0 |
dictionary _09_tkhanoi.pole = {} |
dictionary _09_tkhanoi.ring = {} |
int _09_tkhanoi.ring_base = 0 |
int _09_tkhanoi.ring_spacing = 0 |
bool _09_tkhanoi.single_move = False |
bool _09_tkhanoi.stopped = False |
int _09_tkhanoi.velocity = 0 |