It tells which disk to move for 3 disks. Replace the 3 at the end for the other numbers up to 32. There's always only one possibility since top disk goes where it has not been yet. Unfortunatelly it works only under 32.perl -wle 'print log(~$_&($_+1))/log 2 for 0..2**pop()-2' 3 perl -wle '$n=-1+2**pop;print log($n--&~$n)/log 2while$n' 3
In reply to (Golf) Towers of Hanoi by z0d
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |