Exemplo n.º 1
0
 def test_RandomIsAlwaysGettingACard(self):
     r = Deck(DECK_CARDS)
     i = 0
     # we get a card until the deck is empty
     while i < len(r.cards):
         self.assertTrue(r.get_random_card() > 0)
         i += 1
Exemplo n.º 2
0
def all_cards(init):
    """
    Generate ALL the possible combinations and find the REAL
    probabilities given
    """
    d = Deck(DECK_CARDS)
    d.remove(init)
    ranks = defaultdict(lambda: 0)

    count = 0
    for hand in combinations(d.cards, 4):
        count += 1
        h = RazzHand(list(hand) + init[:3])
        got_rank = h.rank()
        ranks[got_rank] += 1

    return ranks, count