Question: Programming #1 0 Filename: hanoi . py 0 Starter code (don't modify this part; we'll test using the same le): hanoi viz . EX (originally


Programming #1 0 Filename: hanoi . py 0 Starter code (don't modify this part; we'll test using the same le): hanoi viz . EX (originally the "Tower of Brahma" in a temple in the Indian city of Benares), the temple priests are to transfer a tower consisting of fragile disks of gold from one part of the temple to another, one disk at a time. The disks are arranged in order, no two of them the same size, with the largest on the bottom and the smallest on top. Because of their fragility, a larger disk may never be placed on a smaller one, and there is only one intermediate location where disks can be temporarily placed. It is said that if the priests don't complete their task the temple will crumble into dust and the world will vanish in a clap of thunder. Here are the rules the priests must follow: 1. Only one disk may be moved at a time. 2. A larger disk may never be placed on a smaller disk. 3. They can use a third tower, Tower C, to temporarily hold some disks. Tower A Tower B Tower C Save the cheerleader, save the world. Wait. . .sorry, wrong show. Help the priests to save the world. For this assignment, you'll write: 0 A driver, which prompts the user for the number of disks and kicks off the process. 0 A recursive function to move disks from one tower to another. We've provided starter code, hanoi_viz.py, to do a little ascii illustration of the towers. You'll need to call functions dened in this module for the assignment. Requirements. Your program must: 0 Prompt the user to give you the number of disks. Prompt them repeatedly until they give you a valid number. 0 Use a conditional to make sure that the user has provided an integer, not a oat or a string or anything else. 0 The integer they give you must be between 1 and 8 (inclusive). 0 Choose names for the towers. These can be anything you like but keep them short or the illustrations won't look right. 0 Call the given initialize_towers function before calling your own, recursive function. 0 Dene a recursive function that moves disks from one tower to another.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
