ScratchData LogoScratchData
Back to FlippyCatFan's profile

Towers of Hanoi Algorithms

FLFlippyCatFan•Created December 19, 2019
Towers of Hanoi Algorithms
0
0
16 views
View on Scratch

Instructions

Click the Green Flag. The Recursive Algorithm will move a 15-disk tower from the left peg to the right peg. The Iterative Algorithm will then move the 15-disk tower back to the left peg.

Description

Code things: 15 disks takes too long, so I used 11. Bigger disks are read as higher numbers in the code. The disks rendered are numbered from 1 to 11. There is actually a disk ID 12 at the bottom of all three towers, which allows the iterative algorithm to work properly. The recursive algorithm will only move 11 disks, and will not attempt to move the disk ID 12 under normal circumstances, in effect ignoring it. The bottom disk of each tower (which is disk ID 12 for all three towers) is not rendered.

Project Details

Project ID355344062
CreatedDecember 19, 2019
Last ModifiedDecember 30, 2019
SharedDecember 19, 2019
Visibilityvisible
CommentsAllowed