Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This exercise is to simulate 2 0 0 0 0 0 rounds of a dice version of the children's card game War. The purpose of
This exercise is to simulate rounds of a dice version of the children's card game War. The purpose of this simulation is to determine which player has an advantage of based on these rules below.
Rules
There are two players: PLAYER and BANKER. These are just names for the players. Each player has a regular sixsided die. In one round, each player will roll their die and attempt to get the highest value. The rules are:
If either player rolls a six, the game stops. The player with the higher die value wins. If both dice values are the same, then it is a tie.
If neither player has a six in the initial roll, then a player may reroll under these conditions:
If the BANKER initially rolled a or below, the BANKER will reroll their die.
If the PLAYER initially rolled a or below, the PLAYER will reroll their die.
After this reroll, the game stops. The player with the higher die value wins. If both dice values are the same, then it is a tie.
Tasks
The starter code has been created for you. You must use it with the two functions you will write, especially the outcomes dictionary variable declared for you.
Complete the simulateGames function. Simulate the total number of rounds with the rules. Determine the outcome and increase the count on the outcomes dictionary. Use the rollDie function included for you for this task.
Complete the visualizeResults function. Use the seaborn barplot to visualize the outcomes.
Function comments have been added for you.
Answer the questions below.
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