Universal hanoi puzzle solver