Write the Towers of Hanoi program as a shell script. There are two basic strategies: run the shell script recursively as $0, or write a recursive shell function.

Member Avatar
Member Avatar
+0 forum 1

Hey guys I had an assignment to recursively write the Towers of Hanoi then test it. I did not have too much of an issue getting the program written But I am not sure what the book means by test the efficiency do they want the number of moves my program makes, or do they want the time it takes to run. And how do I get either one? help is appreciated [CODE] import TerminalIO.KeyboardReader; public class towers { public static void main(String[] args) { KeyboardReader reader = new KeyboardReader(); int numberofRings = reader.readInt("Enter number of Rings: "); move (numberofRings, …

Member Avatar
Member Avatar
+0 forum 10

So my program uses the list template as the towers and the values in them are disks. I used the push and pop methods with loops to display changing values due to user input. > Rules of the game: > 1. All disks are stacked into an initial tower. > 2. Disks range from smallest at the top to the biggest at the bottom. > 3. Only 1 disk can be moved to another tower per move. > **4. The disk you are moving to the next tower stacks onto possibly another disk, but the selected disk can't be bigger …

Member Avatar
Member Avatar
+0 forum 5

Hey guys, I have the assignment of writing the Towers of Hanoi program then testing it. I already got help measuring the time of the program, but that is not what my professor wanted he wanted to count the iterations. I can't get it down, my program will run but it will not print out correctly. This is the code I was using. [CODE] import TerminalIO.KeyboardReader; public class towers { public static void main(String[] args) { KeyboardReader reader = new KeyboardReader(); int numberofRings = reader.readInt("Enter number of Rings: "); move (numberofRings, 1, 3, 2); } static void move(int n, int …

Member Avatar
Member Avatar
+0 forum 4

The End.