Question: (Java Program) The program is based on the board game Risk. In Risk, each player's goal is to conquer the world by occupying every country.
(Java Program)
The program is based on the board game Risk. In Risk, each player's goal is to conquer the world by occupying every country. The play involves neighboring countries fighting battles. Most battles in Risk involve four armies, two from the attacking country, and two from the defending country.
The process for fighting a battle involves the attacker rolling three dice, and the defender rolling two dice. We will assume these are typical 6-sided dice with values 1 through 6, inclusive. The highest die of the attacker is compared with the highest die of the defender, and the second-highest die of the attacker is compared with the second-highest die of the defender. If both of the attacker's dice are higher than the defender's, the attacker wins the battle and the defender loses two armies. If both of the defender's dice are higher than or equal to the attacker's, the defender wins the battle and the attacker loses two armies. Otherwise, each player loses one army. Some examples follow:
| Attacker Rolls | Defender Rolls | Comparison | Result |
| 1 5 4 | 4 2 | attacker 5 > defender 4, attacker 4 > defender 2 | attacker wins, defender loses two armies |
| 4 3 4 | 2 4 | attacker 4 <= defender 4, attacker 4 > defender 2 | tie, each player loses one army |
| 3 4 3 | 5 3 | attacker 4 <= defender 5, attacker 3 <= defender 3 | defender wins, attacker loses two armies |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
