Ranking a Poker hand (1)

The following are some of the possible hands in Poker, in increasing order of value:

Using the @Card@, @Deck@, @Hand@, and @PokerDeck@ class definitions, write a @PokerHand@ class with methods named @has_one_pair@, @has_two_pair@, etc. that return @True@ or @False@ according to whether or not the hand meets the relevant criteria.

Your code should work correctly for hands that contain 5 cards.

Input

The input consist of two non-negative integers, the number of hands and the number of cards per hand, followed by a shuffled deck of cards.

Output

Print the cards in each hand followed by a blank line, and a line for each of @has_one_pair@, @has_two_pair@, @has_three_of_a_kind@, @has_straight@, @has_flush@, @has_full_house@, @has_four_of_a_kind@, and @has_straight_flush@, followed by a blank line.

Precondition

The number of cards in the shuffled deck is not less than the number of hands times the number of cards per hand.

Problem information

Author: Gabriel Valiente

Generation: 2026-01-25T17:05:56.906Z

© Jutge.org, 2006–2026.
https://jutge.org