# Title: Towers of Hanoi

## Category: image

### Author: tonym

The programming assignment is from my CSC 298 course, Selected Topics on Programming. The program displays the minimal moves in a

Tower of Hanoimathematical game. It assumes the objective of the game is to move a tower ofndiscs from one peg to another of the 3 pegs without ever having a smaller disc underneath a larger disc. Mathematics provides the solution of [(2^n) - 1]. 1 disc, 1 move. 2 discs, 3 moves. 3 discs, 7 moves. And so on. Two ways for a computer scientist to solve this is through iteration and recursion. Using iteration, we alternate moves between the smallest and the next-smallest discs until [(2^n) - 1] discs are moved. In my assignment, I utilize recursion, breaking down the problem to a smaller set of tasks and then breaking those down to a smaller set of tasks and so on until the game is finished. In this instance to movendiscs from peg A to peg C will require a recursive algorithm of three tasks. First move disc (n-1) from A to B. Next move disc (n) from A to C. Last move disc (n-1) from B to C.

A graphic created for my genre analysis in a Tutoring Pedagogy course. The above text is from said genre analysis. Feel free to use the graphic for educational instruction, academic implementation, or public non-commericial presentations.