Ejemplo n.º 1
0
    def test_three_of_a_kind(self):
        deck = Deck()
        deck.get_new_deck()

        community_cards = []
        community_cards.append (Card('2', 'D'))
        community_cards.append (Card('2', 'C'))
        community_cards.append (Card('4', 'D'))

        my_hand = Hand(community_cards)
        my_hand.add (Card('2', 'S'))
        my_hand.add (Card('6', 'D'))

        assert my_hand.three_of_a_kind() and not my_hand.one_pair()
Ejemplo n.º 2
0
        community_cards = []
        community_cards.append (community_cards1 or deck.deal())
        community_cards.append (community_cards2 or deck.deal())
        community_cards.append (community_cards3 or deck.deal())
        community_cards.append (community_cards4 or deck.deal())
        community_cards.append (community_cards5 or deck.deal())

        my_hand = Hand(community_cards)
        my_hand.add (my_cards1)
        my_hand.add (my_cards2)

        if my_hand.is_flush(): count_my_flushes += 1.0
        if my_hand.is_straight(): count_my_straights += 1.0
        if my_hand.four_of_a_kind(): count_my_four_of_a_kind += 1.0
        if my_hand.three_of_a_kind(): count_my_three_of_a_kind += 1.0
        if my_hand.one_pair(): count_my_one_pair += 1.0
        count_my_hand_strength += my_hand.get_strength()

    count_their_straights = 0
    count_their_flushes = 0
    count_their_four_of_a_kind = 0
    count_their_three_of_a_kind = 0
    count_their_one_pair = 0
    count_their_hand_strength = 0
    deck = Deck()

    for i in xrange(int(total)):
        deck.get_new_deck()

        community_cards = []