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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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:

 

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

Here, I have to provide a java solution to the above question.

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Mergesort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education