1 / 16

P resentation

P resentation. Aumm-e-hani munir Maria umer Rakhshanda batool Faiza. Tower of honii. What is Tower of hanoii.

chelsey
Télécharger la présentation

P resentation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Presentation Aumm-e-hani munir Maria umer Rakhshanda batool Faiza

  2. Tower of honii

  3. What is Tower of hanoii • DEFINATION:The Tower of Hanoi is one of the truly classic puzzle games. In the Tower of Hanoi puzzle a player attempts to move a large pile of disks, known as the Tower, from the leftmost peg to the rightmost on the puzzle board. • RULES: The rules of the puzzle state that the player can only move one disk per turn and can never place a larger disk onto a smaller one at any time. • TYPE: Tower of Hanoi Puzzles may consist of any number of disks as long as they total three or more.

  4. How to play Tower of hanoii puzzle • Lets start with three disk

  5. Step 1:move disk 3 on tower 3

  6. Step 2:move disk 2 on tower 2

  7. Step 3:move disk 3 from tower 3 to tower 2

  8. Step 4:move disk 1 on tower 3

  9. Step 5:move disk 3 on tower 1

  10. Step 6:move disk 2 on tower 3

  11. Step 7:move disk 3 on tower 3

  12. Algorithm: • FUNCTION MoveTower(disk, source, dest, spare): IF disk == 0, THEN: move disk from source to dest ELSE: MoveTower(disk - 1, source, spare, dest) // Step1 above move disk from source to dest// Step 2 above MoveTower(disk - 1, spare, dest, source) // Step 3 above END IF

  13. Graphical Representation: • Another way to visualize what happens when you run MoveTower is called a call tree. This is a graphic representation of all the calls. Here is a call tree for MoveTower(3,A,B,C).

  14. Graphical Representation:

  15. Reduction search: • we will consider the state at the top of the figure the starting state. • In this case all three disks are on the left-most peg. And we will consider the state at the bottom right to be the goal state. • Three disks are now all stacked on the right-most peg.

  16. Thanks for your patience Have a nice day……..

More Related