Searching on the net will bring you the answer you need but I'd rather explain th rules here because any search will also lead you to the optimal solution algorithm (used in the solve function which shouldn't be able to cause error by the way, unless you already started to move disks around).
The rules are very simple :
FYI it has been proved that the optimal solution is 2^n - 1 moves. So the "default" game (if you don't use the spinbox to change the number of disks) is 15 moves. Good luck.
- n disks are on the first peg, biggest at the bottom and the goal is to move them to the last peg using the smallest possible number of moves
- you can only move one disk at a time and only the one on top of each pegs
- to move a disk to another peg it must be smaller than any other disk that may be present on the target peg already.
Bookmarks