Towers of Hanoi: Difference between revisions

Content added Content deleted
m (→‎Python - Graphic: (Updated caption positions and arrows directions))
(→‎Python: Graphic: Replaced left and right arrows with 'from' and 'to')
Line 3,558: Line 3,558:
def go(ab):
def go(ab):
a, b = ab
a, b = ab
return [labels[a], ' -> ', labels[b]] if a < b else [
return [labels[a], ' to ', labels[b]] if a < b else [
labels[b], ' <- ', labels[a]
labels[b], ' from ', labels[a]
]
]
return lambda ab: go(ab)
return lambda ab: go(ab)
Line 3,687: Line 3,687:
______
______
________________________
________________________
left -> right
left to right


____
____
______ __
______ __
________________________
________________________
left -> mid
left to mid


______ ____ __
______ ____ __
________________________
________________________
mid <- right
mid from right


__
__
______ ____
______ ____
________________________
________________________
left -> right
left to right


__
__
____ ______
____ ______
________________________
________________________
left <- mid
left from mid


__ ____ ______
__ ____ ______
________________________
________________________
mid -> right
mid to right


____
____
__ ______
__ ______
________________________
________________________
left -> right
left to right


__
__