Python_2  1.0
Functions | Variables
_09_tkhanoi Namespace Reference

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()
 

Detailed Description

Towers of Hanoi, Python/Tk style.

Author
Paulo Roma
Since
2009/08/08

Function Documentation

◆ do_hanoi()

def _09_tkhanoi.do_hanoi (   n)
 Initialize for a new simulation.
    n: number of rings

Referenced by init().

◆ hanoi()

def _09_tkhanoi.hanoi (   n,
  ffrom,
  to,
  work 
)
Recursively move rings until complete or stopped by the user.

◆ init()

def _09_tkhanoi.init ( )

◆ main()

def _09_tkhanoi.main ( )
Main program.

References init().

◆ move_ring()

def _09_tkhanoi.move_ring (   n,
  to 
)
Move ring n - its bounding box coordinates - to pole to.

References Getch.getch.

Variable Documentation

◆ canvas

_09_tkhanoi.canvas = Canvas()

◆ colors

list _09_tkhanoi.colors = []

◆ fly_y

int _09_tkhanoi.fly_y = 32

◆ max_rings

int _09_tkhanoi.max_rings = 24

◆ mw

_09_tkhanoi.mw = Tk()

◆ num_moves

int _09_tkhanoi.num_moves = 0

◆ pole

dictionary _09_tkhanoi.pole = {}

◆ ring

dictionary _09_tkhanoi.ring = {}

◆ ring_base

int _09_tkhanoi.ring_base = 0

◆ ring_spacing

int _09_tkhanoi.ring_spacing = 0

◆ single_move

bool _09_tkhanoi.single_move = False

◆ stopped

bool _09_tkhanoi.stopped = False

◆ velocity

int _09_tkhanoi.velocity = 0