Answered step by step
Verified Expert Solution
Link Copied!

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 200000 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 six-sided 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 re-roll under these conditions:
If the BANKER initially rolled a 3 or below, the BANKER will re-roll their die.
If the PLAYER initially rolled a 2 or below, the PLAYER will re-roll 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

3rd Edition

0128012757, 978-0128012758

More Books

Students also viewed these Databases questions