APPENDIX 1: The standard deck. The standard (US) deck of playing cards contains 4 suits-Spades, Hearts, Diamonds, Clubs- each of which contains 13 cards, ranging in value from the Ace (1) to 10, plus the court cards (or 'face cards') of the Jack, Queen, and King. In Poker, the Ace may count as the lowest value (1) or the highest, above the King. Cards are usually indicated by a short string consisting of the rank then the suit, with the rank being indicated by one of: A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q. K, and the suit by S, H, D C. Thus 6D denotes the 6 of Diamonds, KS the King of Spades, etc. APPENDIX 2: The value of the hands. Poker hands consist of 5 cards, dealt from a well-shuffled deck. These are combinations, not permutations; the order the cards are dealt is not significant. The usual rules allow ties to be broken readily; if two hands are truly tied, count it as half a win. They're rare, but they do happen. The rank of the hands, from lowest to highest: • No pair (high card): The hand does not qualify for any of the other ranks listed. Ties are broken by looking at the highest-ranking card in the hand. If the highest cards are tied, look at the second-highest, and so on. • One pair: Two cards are of the same rank; the other 3 cards have different ranks. Ties broken by comparing values of the pair. If two hands have one pair at the same rank, compare the highest of the remaining 3 cards, as for no pair. Two pair: Two cards with the same rank; two cards with the same rank different from the first pair; and an unrelated card. Break ties by comparing the higher pair; then the lower pair; then the unrelated card. • Three of a kind: Three cards of the same rank, and two unrelated cards. Ties broken by comparing the values of the 3 of a kind. (It's not possible for 2 hands to each have 3 cards of the same rank.) Straight: 5 cards forming an unbroken sequence; not all cards are the same suit. The Ace can count as high (A-K-Q-J-10) or low (5-4-3-2-A). It is not possible to go 'around the corner,' i.e.
USE C++ OR JAVA ---- POST SOURCE CODE
WILL DOWNVOTE FOR INCORRECT ANSWER
WILL REPORT FOR REPEAT ANSWER
NO TIME CONSTRAINT
----------------------------------------------------------------------------------------------------------------------------
Create a simple program that plays poker 1000 times with the following rules:
Each time the program will:
- Shuffle the 52-card deck and deal yourself 5 cards.
- Using the remaining 47 cards, deal other 5 players their 5 cards.
- Determine if your hand would win or lose compared to the others. (Poker hands ranking listed below for reference)
- Program will produce 2 output files (1000 entries):
- A session log output as a CSV (comma-separated value) file, with each hand (you and 5 other hands) on a separate line. For each hand: Output 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.
----------------------------------------------------------------------------------------------------------------------------
The system random-number generator (random() and related functions) for the most common development environments will be more than adequate for this project.
Picture reference for card rankings:
Here, I have to provide a java solution to the above question.
Step by step
Solved in 2 steps