## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# Time for action—making a tower of Hanoi puzzle

The Towers of Hanoi is a classic logical puzzle that you have almost certainly played, maybe even written a computer program to solve it. It involves stacking several pieces in height order onto one of three pegs.

In this chapter, we are going to create that game in a simple sort of way. Don't worry if you have never played it before; I'll explain before each tutorial what we are going to make next.

Here we see a side-view of a tower being built. The peg is shown in brown, the red block is resting on the peg, and the green block is being added to the peg. The height of the tower is the number of blocks ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required