Program in C++ or Java Simple simulation to estimate your likelihood of winning in a game of poker. Assume the game has 6 players. • Repeatedly (500-1000 times): ◦ Shuffle the 52-card deck, and deal yourself a 5-card hand. ◦ Repeatedly (500-1000 times): ▪ Using the remaining 47 cards, deal the other 5 players their hands ▪ Determine if you would win or lose that hand; that is, if your hand would rank highest.2 Update some counters accordingly. ▪ Reshuffle the deck of 47 cards ◦ Record the proportion of the above hands which you won. • For each rank of hand, report the percentage of hands having that rank, and the average winning percentage (average of the averages) for each rank.
Program in C++ or Java
Simple simulation to estimate your likelihood of winning in a game of poker. Assume the game has 6 players.
• Repeatedly (500-1000 times):
◦ Shuffle the 52-card deck, and deal yourself a 5-card hand.
◦ Repeatedly (500-1000 times):
▪ Using the remaining 47 cards, deal the other 5 players their hands
▪ Determine if you would win or lose that hand; that is, if your hand would rank highest.2 Update some counters accordingly.
▪ Reshuffle the deck of 47 cards ◦ Record the proportion of the above hands which you won.
• For each rank of hand, report the percentage of hands having that rank, and the average winning percentage (average of the averages) for each rank.
Produce 2 output files
• A session log output as a CSV (comma-separated value) file, with each hand on a separate line. For each hand: the cards in the hand; what the hand was evaluated as; and its winning percentage.
• A summary showing the percentage of hands falling into each rank, and the overall win percentage for each rank, as a ‘normal’ text file. Don’t just list the percentages; add enough text to make it reader-friendly.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps