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.