예제 #1
0
 def best_poker_hand(self, cards):
     """
     Check the hand after the best poker hand of all cards in the hand
     :return: best poker hand as object with highest card in the poker hand and highest card in the hand
     """
     cards.extend(self.cards)
     return cardlib.PokerHand(cards)
예제 #2
0
def test_straight_flush():
    deck = cl.StandardDeck()
    straight_flush_hand = cl.Hand()
    straight_flush_hand.get_cards(deck, 5)
    pokerhand = cl.PokerHand(straight_flush_hand.cards)
    assert pokerhand.card_value == 6
    assert pokerhand.poker_type == cl.PokerHandTypes.Straight_flush

    return pokerhand
예제 #3
0
def test_four_of_a_kind():
    deck = cl.StandardDeck()
    fours_hand = cl.Hand()
    deck.sort_cards()

    fours_hand.get_cards(deck, 5)

    pokerhand = cl.PokerHand(fours_hand.cards)

    assert pokerhand.poker_type == cl.PokerHandTypes.Four_of_a_kind
    assert pokerhand.card_value == 2
예제 #4
0
def test_flush():
    deck = cl.StandardDeck()
    flush_hand = cl.Hand()
    for i in range(5):
        flush_hand.get_cards(deck, 1)
        deck.deal_cards()

    pokerhand = cl.PokerHand(flush_hand.cards)

    assert pokerhand.poker_type == cl.PokerHandTypes.Flush
    assert pokerhand.card_value == 10
예제 #5
0
def test_straigth():
    deck = cl.StandardDeck()
    hand = cl.Hand()
    for i in range(12):
        deck.deal_cards()
    hand.get_cards(deck, 4)
    for i in range(13):
        deck.deal_cards()
    hand.get_cards(deck, 1)
    pokerhand = cl.PokerHand(hand.cards)
    print(hand)
    assert pokerhand.poker_type == cl.PokerHandTypes.Straight
    assert pokerhand.card_value == 14
예제 #6
0
def test_one_pair():
    deck = cl.StandardDeck()
    pair_hand = cl.Hand()
    deck.sort_cards()

    pair_hand.get_cards(deck, 2)
    for j in range(3):
        for i in range(3):
            deck.deal_cards()
        pair_hand.get_cards(deck, 1)

    pokerhand = cl.PokerHand(pair_hand.cards)

    assert pokerhand.poker_type == cl.PokerHandTypes.One_pair
    assert pokerhand.card_value == 2
예제 #7
0
def test_full_house():
    deck = cl.StandardDeck()
    full_house_hand = cl.Hand()
    deck.sort_cards()

    full_house_hand.get_cards(deck, 3)

    deck.deal_cards()

    full_house_hand.get_cards(deck, 2)

    pokerhand = cl.PokerHand(full_house_hand.cards)

    assert pokerhand.poker_type == cl.PokerHandTypes.Full_house
    assert pokerhand.card_value == 2

    return pokerhand
예제 #8
0
def test_three_of_a_kind():
    deck = cl.StandardDeck()
    triple_hand = cl.Hand()
    deck.sort_cards()

    triple_hand.get_cards(deck, 3)
    for j in range(2):
        for i in range(3):
            deck.deal_cards()
        triple_hand.get_cards(deck, 1)

    pokerhand = cl.PokerHand(triple_hand.cards)

    assert pokerhand.poker_type == cl.PokerHandTypes.Three_of_a_kind
    assert pokerhand.card_value == 2

    return pokerhand
예제 #9
0
def test_two_pair():
    deck = cl.StandardDeck()
    two_pair_hand = cl.Hand()
    deck.sort_cards()

    two_pair_hand.get_cards(deck, 2)
    for j in range(1):
        for i in range(6):
            deck.deal_cards()
        two_pair_hand.get_cards(deck, 2)
        for i in range(6):
            deck.deal_cards()
        two_pair_hand.get_cards(deck, 1)

    pokerhand = cl.PokerHand(two_pair_hand.cards)

    assert pokerhand.poker_type == cl.PokerHandTypes.Two_pair
    assert pokerhand.card_value == 4

    return pokerhand