Towers of Hanoi: Difference between revisions

Undo revision 125368 by 206.75.102.162 (talk) last editor was confused
(→‎{{header|Python}}: The code was buggy: ndisks is the number of disks to be moved (recursively) and not the index of the disk to be moved.)
(Undo revision 125368 by 206.75.102.162 (talk) last editor was confused)
Line 1,418:
if ndisks:
hanoi(ndisks-1, startPeg, 6-startPeg-endPeg)
print "Move disk %d from peg %d to peg %d" % (ndisks, startPeg, endPeg)
hanoi(ndisks-1, 6-startPeg-endPeg, endPeg)
 
Anonymous user