Poker hand analyser

From Rosetta Code
Revision as of 20:49, 9 December 2013 by rosettacode>Dwarring (Created page with "{{task}}Parse and rank 5-card poker hands Create a program to parse a single 5 card poker hand and rank it according to the List of poker hands [https://en.wikipedia.org/wiki...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Task
Poker hand analyser
You are encouraged to solve this task according to the task description, using any language you may know.

Parse and rank 5-card poker hands

Create a program to parse a single 5 card poker hand and rank it according to the List of poker hands [1].

Each input card should be specified as a two characters indicating face and suit. For example 2d (two of diamonds).

Faces are: a, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, j, q, k

Suits are: h (hearts), d (diamonds), c (clubs), and s (spades). Or you can use the unicode suit characters: ♥ ♦ ♣ ♠

Duplicate cards are illegal.

The program should analyse a single hand and produce one of the following outputs:

straight-flush, four-of-a-kind, full-house, flush, straight, three-of-a-kind, two-pair, one-pair, high-card

Examples