예제 #1
0
파일: range.py 프로젝트: d4yu/python-poker
    def from_str(cls, range_str):
        all_hands = combinations(deck, 2)
        parts = range_str.split(', ')
        hands = []
        for part in parts:
            if '-' in part:
                pass
            else:
                if 's' in part:
                    hand = Hand(
                        [Card(part[0] + 'c'), Card(part[1] + 'c')]
                    )
                    filter_func = suited_only
                else:
                    hand = Hand(
                        [Card(part[0] + 'c'), Card(part[1] + 'd')]
                    )
                    if hand.is_pair:
                        filter_func = pairs_only
                    else:
                        filter_func = offsuit_only

                if '+' in part:
                    min_ = Two.evaluate_percentile(hand)
                    tmp = filter(score_min(min_), map(Hand, all_hands))
                else:
                    tmp = pair_combinations(hand[0].rank)
                hands.extend(filter(filter_func, tmp))

        return Range(hands)
예제 #2
0
    def from_str(cls, range_str):
        all_hands = combinations(deck, 2)
        parts = range_str.split(', ')
        hands = []
        for part in parts:
            if '-' in part:
                pass
            else:
                if 's' in part:
                    hand = Hand([Card(part[0] + 'c'), Card(part[1] + 'c')])
                    filter_func = suited_only
                else:
                    hand = Hand([Card(part[0] + 'c'), Card(part[1] + 'd')])
                    if hand.is_pair:
                        filter_func = pairs_only
                    else:
                        filter_func = offsuit_only

                if '+' in part:
                    min_ = Two.evaluate_percentile(hand)
                    tmp = filter(score_min(min_), map(Hand, all_hands))
                else:
                    tmp = pair_combinations(hand[0].rank)
                hands.extend(filter(filter_func, tmp))

        return Range(hands)
예제 #3
0
파일: range.py 프로젝트: d4yu/python-poker
 def func(hand):
     percentile = Two.evaluate_percentile(hand)
     if percentile >= min_:
         return True
     else:
         return False
예제 #4
0
파일: range.py 프로젝트: d4yu/python-poker
 def func(hand):
     percentile = Two.evaluate_percentile(hand)
     if (1 - percentile) <= max_:
         return True
     else:
         return False
예제 #5
0
 def func(hand):
     percentile = Two.evaluate_percentile(hand)
     if percentile >= min_:
         return True
     else:
         return False
예제 #6
0
 def func(hand):
     percentile = Two.evaluate_percentile(hand)
     if (1 - percentile) <= max_:
         return True
     else:
         return False