Comment by thaumasiotes
Comment by thaumasiotes 2 days ago
You should try playing with one of the toys. It's not at all difficult to move 7 of them.
It's not necessary to use a stack. If you have a goal, you can work "top down", with nothing held in memory. All you need to know to begin the move is whether you're moving an odd number of discs (in which case, the first move will be onto the target peg) or an even number (in which case it will be onto the third peg).
Yes, I'm aware of the iterative solution, which is why I explicitly mentioned the recursive one.
They tried to give the algorithm description to the LLMs, but they also used the recursive solution (see page 25 of the paper).