In the strategic board game called Risk, one player can attack up to three soldiers simultaneously, while the defending player can defend up to two. In the case of exactly three attackers and two defenders, the collision is as follows. An attacking player rolls three red dice while the defending player rolls two blue dice. Then they compare the bigest throws of the attacker and the defender. The lesser value loses a soldier, in the case of equal values the attacker loses one soldier. Then the second largest numbers are also compared in the same way. Thus, the battle has three outcomes: the attacker loses two soldiers, each side loses 1-1 soldiers, the defender loses two soldiers. Simulate 1000 times the experiment and determine the relative frequency of the three events. Simulate 1000000 times the experiment and determine the relative frequency of the three events. Calculate the exact probability of the three outcomes by examining all possible cases. The probability is the ratio of the favorable cases and the total number of cases. Write these results with 5 decimal places leaving 3 spaces between them! The output of the program should look like this (of course with other numbers)
Attacker Draw Defender
1000 experiments 0.35200 0.44400 0.20400
1000000 experiments 0.33988 0.43011 0.23001
Probability 0.34000 0.43000 0.23000
Write a code in Python 3 that can be run in a terminal. Upload your solution in CodePost.io; the filename must be
. The first lines of the code should be:risk.py
"""
I encoded this program myself, did not copy or rewrite the code of others,
and did not give or send it to anyone else.
Your Full Name
"""