Question
Problem 4: Texas Hold 'Em Write code in python and sagemath Grading criteria: correctness of code, to be judged as if your solution to problem
Problem 4: Texas Hold 'Em
Write code in python and sagemath
Grading criteria: correctness of code, to be judged as if your solution to problem 3 is completely correct.
Texas Hold 'Em is the variety of poker most often shown on television. Each player is initially dealt two cards (kept hidden), and eventually five more cards are dealt (face up) on the table. Each player's holding is ranked according to the best hand that can be made from their two cards plus the five common cards. (The bidding aspect of the game is not relevant for this problem.)
3a. Write a function which, given a set of seven distinct cards, identifies the highest-ranking hand which can be made using some five of the cards. In case of a tie, you may return any hand which ties for the highest ranking.
3b. Write a function which, given two pairs of cards, computes the probability that for a random set of five common cards (where all nine cards in question are distinct), the first pair will outrank the second pair. For full credit, you should do this by exhausting over all possibilities for the common cards, rather than doing a random sample.
3c. Write a function, given one pair of distinct cards, computes the probability that if one chooses another pair and five common cards at random from the remaining cards (so again all nine cards in question are distinct), the given pair will outrank the other pair. For this problem, instead of exhaustion, use random samples.
3d. Determine the values of the function you wrote in 3c for all possible pairs of distinct tards. Note that this probability should depend only on the values of the two cards and (if the values are distinct) whether the two cards are of the same or different suits.
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