Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The game of craps is a popular game played with a pair of dice. The basic rules of the game are as follows: A player,
The game of craps is a popular game played with a pair of dice. The basic rules of the game are as follows: A player, also known as the "shooter" rolls a pair of dice. If he/she rolls a total of 7 or 11, then the player automatically wins. If he/she rolls a total of 2, 3, or 12, then the player automatically loses. If the player rolls any other combination (4, 5, 6, 8,9, or 10), then a "point" is set for that total. At this point, the player continues to rol the dice. If, on the second roll, the player rolls the "point," then the player wins. If, on the second roll, the player rolls a 7, then the player loses. If the player rolls anything else, then the player will roll the dice a third time. The player will continue to roll the dice until he/she either rolls the set "point" (a win) or until he/she rolls a 7 (a loss). The following are some examples: Example 1 Example 2 Example 3 First Roll-7... player wins First Roll-3.. player loses First Roll-5... point is set to!5 Second Roll- 3... continue to roll Third Roll-11. continue to roll Fourth Roll- 8... continue to roll Fifth Roll-5... this matches the point of 5, therefore player wins Example 4 First Roll-8... point is set to8 Second Roll-5... continue to roll Third Roll-7... player loses Your objective is to write a multi-threaded program in C C++ that simulates 1,000,000,000 games of craps using 10 threads (100,000,000 games per thread)
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