Write a MEL procedure that recursively creates the Tower of Hanoi. The procedure
ID: 3593149 • Letter: W
Question
Write a MEL procedure that recursively creates the Tower of Hanoi. The procedure should create the first (bottom) ring, then duplicate itself (second ring), scale the duplicated ring down, and moved up, then call the same procedure to create the third, until it creates the number of rings specified by the user. You do not need to create the base in the procedure.
The procedure should take the following parameters:
a. The name of the first (bottom)ring
b. The radius of the first ring
c. The scaling percentage for each duplicated ring
d. A flag indicates whether it’s the first ring
e. The total number of rings to be created
Explanation / Answer
The Tower of Hanoi puzzle was invented by the French mathematician Edouard Lucas in 1883. He was inspired by a legend that tells of a Hindu temple where the puzzle was presented to young priests. At the beginning of time, the priests were given three poles and a stack of 64 gold disks, each disk a little smaller than the one beneath it. Their assignment was to transfer all 64 disks from one of the three poles to another, with two important constraints
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.