#### Description of this paper

##### c# Assignment

Description

solution

Question

4. The board game Risk requires the throw of dice to simulate battles. Write a C# Risk battle roller simulation. The rules are as follows. ? You, the attacker, will roll 1, 2 or 3 red dice: You must have at least one more army in your territory than the number of dice you roll. The defender will roll either 1 or 2 white dice: To roll 2 dice, he or she must have at least 2 armies on the territory under attack. To decide a battle compare the highest die each of you rolled. If yours (the;2;attacker?s) is higher, the defender loses one army from the territory under attack. But if the defender?s die is higher than yours, you lose one army from the territory you attacked from. If each of you rolled more than one die, now compare the two next-highest dice and repeat the process. In case of a tie, the defender always wins. The attacker can never lose more than 2 armies on a single roll.;Example Roll;Attacker?s Dice;Defender?s Dice;From above, compare the highest die from each person: 6 (attacker) and 5 (defender), so the defender loses one army. Next, compare the next-highest dice: 3 (attacker) and 4 (defender), so the attacker loses one army. In total, each player loses one army for this particular roll. Input from the keyboard will consist of the number of attacking and defending armies. All battles will fight to the end, and assume the maximum possible dice for each roll. Output each roll and determine if the territory was captured or defended. Finally, ask the user to run again. Use methods as needed. Output should look similar to below.;Sample Run;Enter number of attackers: 20 Enter number of defenders: 18 Roll Armies Left 1 Attack: 4 3 1 18 Defend: 4 3 18 2 Attack: 3 2 1 16 Defend: 6 2 18 3 Attack: 6 4 1 16 Defend: 4 3 16 4 Attack: 5 4 2 14 Defend: 6 4 16 5 Attack: 6 3 1 14 Defend: 3 2 14 6 Attack: 4 4 4 14;10 Attack: 4 3 1 9 Defend: 6 1 9 11 Attack: 5 2 1 7 Defend: 5 5 9 12 Attack: 2 2 2 5 Defend: 6 5 9 13 Attack: 5 4 2 5 Defend: 1 1 7 14 Attack: 6 1 1 4 Defend: 1 1 6 15 Attack: 2 1 1 2 Defend: 6 6 6 16 Attack: 6 2 Defend: 4 2 5;3;Defend: 3 2 12 7 Attack: 6 3 2 12 Defend: 6 3 12 8 Attack: 6 6 6 11 Defend: 6 1 11 9 Attack: 6 1 1 10 Defend: 5 4 10;17 Attack: 1 1 Defend: 4 2 5 Territory defended!! Run again (Y/N): n;Name the program: RiskGameXX.cs, where XX are your initials

Paper#65039 | Written in 18-Jul-2015

Price : \$32