import towers def plan(source, target, other, num_disks): #source = where to move from #target = where to move to #other = the "other" tower print "move from " + source.name + " to " + target.name if num_disks == 1: towers.move(source, target) else: #move n-1 disks from source to other plan(source, other, target, num_disks-1) #move from source to target towers.move(source, target) #move n-1 disks from other to target plan(other, target, source, num_disks-1) left = towers.Tower("left", [4, 3, 2, 1]) middle = towers.Tower("middle", []) right = towers.Tower("right", []) plan(left, right, middle, len(left.disks)) print "left: " + str(left.disks) print "middle: " + str(middle.disks) print "right: " + str(right.disks)