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)
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)
def func(hand): percentile = Two.evaluate_percentile(hand) if percentile >= min_: return True else: return False
def func(hand): percentile = Two.evaluate_percentile(hand) if (1 - percentile) <= max_: return True else: return False