That's weird. Are you sure that you've entered these lines?
It depends on how a solution is specified. You could give the sequence
to someone and without understanding the rules it would be possible to play the game. You'd have to know how to move odd and even disk numbers differently but you could colour the disks accordingly which would give them a nice touch.
If you desperately need to know the positions they could be calculated from \(n\) and \(a(n)\):
Code:
def hanoi(n):
k, a = n, 1
while not k % 2:
k /= 2
a += 1
p = n / 2**a
q, r = (p % 3, (p+1) % 3) if a % 2 else ((-p) % 3, (-p-1) % 3)
return a, q, r
for i in range(1, 2**5):
print hanoi(i)
Code:
(disk, from, to)
(1, 0, 1)
(2, 0, 2)
(1, 1, 2)
(3, 0, 1)
(1, 2, 0)
(2, 2, 1)
(1, 0, 1)
(4, 0, 2)
(1, 1, 2)
(2, 1, 0)
(1, 2, 0)
(3, 1, 2)
(1, 0, 1)
(2, 0, 2)
(1, 1, 2)
(5, 0, 1)
(1, 2, 0)
(2, 2, 1)
(1, 0, 1)
(3, 2, 0)
(1, 1, 2)
(2, 1, 0)
(1, 2, 0)
(4, 2, 1)
(1, 0, 1)
(2, 0, 2)
(1, 1, 2)
(3, 0, 1)
(1, 2, 0)
(2, 2, 1)
(1, 0, 1)
Agreed.