Simple Poker game X59064


Statement
 

pdf   zip   main.py

html

Using the Card, Deck, Hand, PokerDeck, and PokerHand class definitions, write a Player class, a Game class, and a program to play a simple Poker game with any number of players.

In this simple poker game, each of the players deals a hand from a shuffled deck. Whoever has the highest Poker hand wins.

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

Input

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

Output

For each player, print the player and the hand dealt by the player along with its classification, followed by a blank line. Print also the winner of the game.

Precondition

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

Public test cases
  • Input

    2
    5
    Ace of Spades
    Queen of Diamonds
    Jack of Clubs
    6 of Diamonds
    5 of Spades
    3 of Hearts
    6 of Hearts
    9 of Hearts
    Jack of Hearts
    Ace of Hearts
    9 of Diamonds
    King of Spades
    King of Hearts
    Ace of Clubs
    Ace of Hearts
    

    Output

    Player 1
    Ace of Hearts
    Ace of Clubs
    King of Hearts
    King of Spades
    9 of Diamonds
    Two pair
    
    Player 2
    Ace of Hearts
    Jack of Hearts
    9 of Hearts
    6 of Hearts
    3 of Hearts
    Flush
    
    Winner: Player 2
    
  • Input

    1
    5
    Ace of Spades
    Queen of Diamonds
    Jack of Clubs
    6 of Diamonds
    5 of Spades
    

    Output

    Player 1
    5 of Spades
    6 of Diamonds
    Jack of Clubs
    Queen of Diamonds
    Ace of Spades
    None
    
    Winner: Player 1
    
  • Input

    0
    5
    Ace of Spades
    Queen of Diamonds
    Jack of Clubs
    6 of Diamonds
    5 of Spades
    

    Output

    Winner: None
    
  • Information
    Author
    Gabriel Valiente
    Language
    English
    Official solutions
    Python
    User solutions
    Python