The Tower of Hanoi is a mathematical game or puzzle consisting of three rods and several disks of various diameters, which can slide onto any rod. The puzzle begins with the disks stacked on one rod in order of decreasing size, the smallest at the top, thus approximating a conical shape
This implementation of the Tower of Hanoi game utilizes JavaScript and event listeners to create an interactive user experience. Upon initiating the game, users are prompted to specify the number of disks they wish to play with. The objective is to solve the puzzle within a predefined number of moves. Completing the game within the allowed move count results in a win, whereas exceeding this limit results in a loss.
- Only one disk can be moved at a time.
- Only the disk at the top of a stack can be moved.
- A disk cannot be placed on top of another disk with a smaller diameter.