Towers of Hanoi – a Java Programming Solution

Towers of Hanoi is a game with three poles labeled A, B and C and several different-size numbered disks, each with a hole in the center. Initially, all of the disks are on pole A, with the largest disk on the bottom, then the next largest and so forth. Here is how it looks when you start the game:

towers of hanoi

The object of the game is to move all of the disks from pole A to pole B; pole C is used for temporary storage. Here are the rules of the game:

  • Only one disk may be moved at a time