Poker hand analyser: Difference between revisions

m
added a ;Task: (bold) header, made other wording changes to the task's preamble (spelled-out some numbers).
(Added Elixir)
m (added a ;Task: (bold) header, made other wording changes to the task's preamble (spelled-out some numbers).)
Line 1:
{{draft task}} [[Category:Cards]] [[Category:Games]]
[[Category:Cards]]
Create a program to parse a single 5 card poker hand and rank it according to this [[wp:List_of_poker_hands|list of poker hands]].
[[Category:Games]]
 
;Task:
A poker hand is specified as a space separated list of 5 playing cards.
Create a program to parse a single 5five card poker hand and rank it according to this [[wp:List_of_poker_hands|list of poker hands]].
 
 
A poker hand is specified as a space separated list of 5five playing cards.
 
Each input card has two characters indicating face and suit.
Line 14 ⟶ 19:
Duplicate cards are illegal.
 
The program should analyseanalyze a single hand and produce one of the following outputs:
 
straight-flush
four-of-a-kind
Line 28 ⟶ 32:
 
Examples:
 
2♥ 2♦ 2♣ k♣ q♦: three-of-a-kind
2♥ 5♥ 7♦ 8♣ 9♠: high-card
Line 41 ⟶ 44:
The programs output for the above examples should be displayed here on this page.
 
 
For extra credit:
;Extra credit:
# use the playing card characters introduced with Unicode 6.0 (U+1F0A1 - U+1F0DE).
# allow two jokers
Line 48 ⟶ 52:
::* five-of-a-kind would then be the highest hand
 
Extra Credit 2. Examples:
 
For;More extra credit examples:
joker 2♦ 2♠ k♠ q♦: three-of-a-kind
joker 5♥ 7♦ 8♠ 9♦: straight
Line 63 ⟶ 67:
joker Q♦ joker A♦ 10♦: straight-flush
joker 2♦ 2♠ joker q♦: four-of-a-kind
<br><br>
 
=={{header|C++}}==