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

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

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

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY