Question
In JAVA Your goal is to build a multi-player game where the goal is to be the last player to survive. Each player starts with
In JAVA
Your goal is to build a multi-player game where the goal is to be the last player to survive. Each player starts with 100 health points, which are reduced every time a successful attack takes place. A player can report his condition, determined by the number of health points. The table below shows the condition as determined by health points.
100 excellent 90-99 very good
80-89 good 70-79 average
50-69 poor 30-49 terrible
1-29 critical 0 dead
When the program starts, it needs to know how many players will play and the name of each player. Each player gets a turn, and then continues round-robin. A player must be alive to have a turn. When a players turn comes up, he is asked the name of the player he wants to attack. If a player attempts to attack himself, he forfeits his turn and it goes to the next player in line. A player should not be allowed to attack another player whos already dead. Once an opponent has been chosen, the program generates a random number between 0 and 20. If the value falls between 0 and 9, the attack is considered a miss and the opponent suffers no damage. If the value falls between 10 and 20, decrease the opponents health by that amount. Afer damage is inflicted, and before the next players turn, the program should display the condition of all the players, whether alive or not. The program should never show the number of health points lost in an attack or that remain for the player. The only way of gauging the impact of an attack is by looking at the condition of the player. Afer a players turn has taken place and the attack results have been made, the turn goes to the next player in line who is alive. If only one player remains who is still alive, the game is over and the last player wins.
This question has been asked before by someone else but the answer given to them was completely wrong.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started