USE C++ OR JAVA  --- POST SOURCE CODE WILL UPVOTE FOR CORRECT ANSWER ONLY --------------------------------------------------------------------------------------------------- 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) Your 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. --------------------------------------------------------------------------------------------------- The system random-number generator (random() and related functions) for the most common development environments will be more than adequate for this project.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

USE C++ OR JAVA  --- POST SOURCE CODE

WILL UPVOTE FOR CORRECT ANSWER ONLY

---------------------------------------------------------------------------------------------------

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)
  • Your 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.

---------------------------------------------------------------------------------------------------

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:

 

Flush: All 5 cards are the same suit and they do not form a sequence. Ties broken by comparing
card ranks, as for no-pair hands; there is no relative ranking of the suits themselves.
Full House: Three of a kind plus a pair: three cards of one rank, and 2 cards of another rank.
Ties broken by comparing the values of the three cards.
• Four of a Kind: 4 cards one one rank, and 1 unrelated card. Ties broken by comparing values of
the 4 of a kind.
Straight Flush: A straight, and a flush: 5 cards in an unbroken sequence, all the same suit. A
Straight Flush headed by the Ace as high card (A-K-Q-J-10) is a royal flush. The likelihood of a
royal flush in 5 cards is about 1 in 650,000 (the exact odds are 649,739:1). In a best-5 game like
Texas Hold 'Em, the odds are 'only' about 39,000 to 1 against.
Transcribed Image Text:Flush: All 5 cards are the same suit and they do not form a sequence. Ties broken by comparing card ranks, as for no-pair hands; there is no relative ranking of the suits themselves. Full House: Three of a kind plus a pair: three cards of one rank, and 2 cards of another rank. Ties broken by comparing the values of the three cards. • Four of a Kind: 4 cards one one rank, and 1 unrelated card. Ties broken by comparing values of the 4 of a kind. Straight Flush: A straight, and a flush: 5 cards in an unbroken sequence, all the same suit. A Straight Flush headed by the Ace as high card (A-K-Q-J-10) is a royal flush. The likelihood of a royal flush in 5 cards is about 1 in 650,000 (the exact odds are 649,739:1). In a best-5 game like Texas Hold 'Em, the odds are 'only' about 39,000 to 1 against.
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.
3-2-A-K-Q is NOT a straight. Ties broken by comparing highest card in sequence.
Transcribed Image Text: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. 3-2-A-K-Q is NOT a straight. Ties broken by comparing highest card in sequence.
Expert Solution
Step 1

The question involves making an an entire game which is beyond the scope of answer, we thus answer with a poker game code instead and the game method can be called 1000 times and be saved in a csv. 

steps

Step by step

Solved in 5 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY