Question: Using C++ : For this program we are going to carry out Monte Carlo simulation , also known as a rollout analysis . We are
Using C++ :
For this program we are going to carry out Monte Carlo simulation, also known as a rollout analysis. We are dealing with a partially-observable situation, a card game. We cannot explore every possible handthe search space is far too large for that. Because our information is limited, we will try to estimate our chances of winning by simulating several hands.
We are going to use a modified form of Texas Hold Em. Each player is dealt 3 cards. There are also 5 community cards face-up in the middle of the table that are considered part of everyones hand. The object is to use your 3 cards and any 2 of the 5 community cards to make the best poker hand you can
First, we must make the best poker hand we can by selecting 2 of the 5 community cards. There are only 10 ways to select 2 items from 5, so we can exhaustively check all possibilities.
We want to answer the question, how well will my hand do against whatever hands my opponents have? This will give a way to estimate the value of the hand. For example, if there are 5 players, and this analysis suggests I would have the highest hand 22% of the time, I should stay in (22% > 1/5). On the other hand, if I am only 5% likely to have the highest hand, folding and waiting for a better hand is a better strategy. We can simply generate every possible combination of hands for all opponents, search through them, and count how many of them there are where I have the winning hand.
Do a rollout analysis: Given the cards remaining, deal out hands to all the opponents and see how Id do against those hands. Then deal another set of hands for the opponents and see how Id do against those. And again, and again Of course, this is only a tiny sample of all possible hands. We know the analysis wont be exact, were just trying to get a go/no-go decision on whether to stay in. So, to save time and let us check more hypothetical hands, randomly select from the community cards when selecting for opponents.
Use this as a sample of the search space to estimate the probability of winning. For example, if I do this 50 times, and I have the highest hand in 7 of them, then my estimated chance of winning the hand is 7/50 = 14%. Very good if Im in a 10-player game, not so good if Im in a 3-player game.
Write a program to deal poker hands for a 5-player game and do a Monte Carlo analysis of each. Test your method by carrying out 500 hands under 3 conditions: 20, 100, and 200 random deals per hand. After the Monte Carlo exploration of 20, 100, or 200, deal the remaining players their real cards and see how you really did (won/lost), with the opponents selecting their best hands, not randomly choosing. Report for each condition (20/100/200) the expected likelihood of winning (to the nearest 1%) and use this to compute the overall expectation. (Hint: It should be about 20% for a 5-person game, but probably wont be exactly 20%.) Also, for each condition, report how many of the hands were actually won. For example, if your analysis led you to expect a 14% chance of winning certain hands, and you actually won 12% of those hands, your estimate was pretty accurate. If you actually won 22% (or 4%), your estimate was off. Use the squared difference as your error metric.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
