Context: I made a program that allowed the user to play TOWERS OF HANOI. user can perid the amount of discs to play and do the movements. HANOI game: It consists of a game of 3 towers and discs. The objective is to pass the disks from a source tower to a destination tower. The problem I have is that the game always starts in Tower 1. I would like you to help me modify the method I have to START THE GAME: When I run it, it always starts in tower 1. I would like the method to start in the tower that the user says. also that he says which tower he wants to finish. Example: I want the game to start in tower 2 and end in tower 1 and validate that the game is over. I HAVE ALL THE GAME MADE. the problem lies in what has been said above. METHOD TO MODIFY SO that the user requests (ORIGIN Tower, DESTINATION Tower and validate if I win the game.) /// public static void Start_hanoi(){ // REQUEST NUMBER OF DISCS System.out.println("Write the number of disks to process: "); ndisk = leer.nextInt(); // Fill Tower A for (int disk=ndisk; disk >= 1; disk--){ TowerA.stack_disk(new Disk(disk, "*")); } } // (Modify this method so that it asks the user Tower source, Tower destination and validate if I win the game). THANKS FOR HELP !!! :D
Context: I made a program that allowed the user to play TOWERS OF HANOI. user can perid the amount of discs to play and do the movements.
HANOI game: It consists of a game of 3 towers and discs. The objective is to pass the disks from a source tower to a destination tower.
The problem I have is that the game always starts in Tower 1.
I would like you to help me modify the method I have to START THE GAME: When I run it, it always starts in tower 1. I would like the method to start in the tower that the user says. also that he says which tower he wants to finish.
Example: I want the game to start in tower 2 and end in tower 1 and validate that the game is over. I HAVE ALL THE GAME MADE. the problem lies in what has been said above.
METHOD TO MODIFY SO that the user requests (ORIGIN Tower, DESTINATION Tower and validate if I win the game.)
///
public static void Start_hanoi(){
// REQUEST NUMBER OF DISCS
System.out.println("Write the number of disks to process: ");
ndisk = leer.nextInt();
// Fill Tower A
for (int disk=ndisk; disk >= 1; disk--){
TowerA.stack_disk(new Disk(disk, "*"));
}
}
//
(Modify this method so that it asks the user Tower source, Tower destination and validate if I win the game).
THANKS FOR HELP !!! :D
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)