コード例 #1
0
def setup_counting_strategy():
    r = HouseRules(shoe_size=4, bet_limits=[10, 500])
    c = Cards(rules=r)
    c.burn_card()
    c.add_to_seen_cards(card=1)
    cs = CountingStrategy(rules=r, cards=c)
    return c, cs
コード例 #2
0
    def test_remaining_decks(self):
        """
        Tests the remaining_decks method.

        """
        for shoe_size in [4, 6, 8]:
            r = HouseRules(shoe_size=shoe_size, bet_limits=[10, 500])
            c = Cards(rules=r)
            # burn within 1 card of changing remaining decks amount (rounded to the nearest integer)
            for i in range(0, 26):  # half a deck of cards
                c.burn_card()
                assert c.remaining_decks() == r.shoe_size
            c.burn_card()
            assert c.remaining_decks() == r.shoe_size - 1
コード例 #3
0
    def test_cut_card_reached(self, penetration, expected):
        """
        Tests the cut_card_reached method.

        """
        for shoe_size in [4, 6, 8]:
            r = HouseRules(shoe_size=shoe_size, bet_limits=[10, 500])
            c = Cards(rules=r)
            if penetration < 0.5 or penetration > 0.9:
                with pytest.raises(ValueError):
                    c.cut_card_reached(penetration=penetration)
            else:
                # burn within 1 card of reaching desired penetration
                for i in range(0, int(r.shoe_size * penetration * 52) - 1):
                    c.burn_card()
                assert c.cut_card_reached(
                    penetration=penetration) is not expected

                # burn enough cards to reach desired penetration
                c.burn_card()
                assert c.cut_card_reached(penetration=penetration) is expected