Please help. I have no idea where to start. Assignment is due tonight. Thanks in
ID: 3532253 • Letter: P
Question
Please help. I have no idea where to start. Assignment is due tonight. Thanks in advance.
The card game poker is a game of chance. If you aren't familiar with the game, you can read about it at the following links (among other places). The deck is described at http://en.wikipedia.org/wiki/Standard_52-card_deck; poker rules are described at http://www.pagat.com/poker/rules/. The names of hands, e.g., flush, straight, and so forth, and what they mean, can be found at http://www.pokerlistings.com/poker-hand-ranking. This assignment ignores betting completely; it is only concerned with the relative frequency of various kinds of poker hands.
The code provided in the three classes below calculates the frequency of obtaining a straight (five cards running consecutively, e.g. 3-4-5-6-7); and a flush (all five cards of the same suit). The calculation for a straight does not exclude the possibility of the straight also being a flush, e.g., 3-4-5-6-7 all of the same suit. As you will surely notice, the code for determining a straight is considerably more complicated than the flush code.
Using the given algorithms as a model, your job for this assignment is to
1) determine the chances (the relative frequency) of obtaining a full house;
2) determine the chances (the relative frequency) of getting a flush that is not a straight; and
3) determine the chances (the relative frequency) of obtaining nothing: five cards with distinct values, not of the same suit, and not a straight;
A word on how the given code works. We run one million experiments. Each time, we a) assemble an unshuffled deck (the cards appear in a specific order, e.g., all the hearts, then all the diamonds, etc.); b) we shuffle the deck, and then look at the first five cards - this is the hand we're dealt; and c) we then examine this hand to see if it's a straight or a flush.
Below we've given you 3 classes, a Card class, a Deck class, which makes use of the Card class, and a driver class, HandTester. Study these classes carefully. You need to copy each class to your machine and of course you need to compile them. Thye provide the framework for developing the three methods that make up the assignment.
Explanation / Answer
I can help you write the last 3 functions. When tonight is this due?