Exemple #1
0
def get_opponent_flop_reaction(screen_area, stack_collection, db):
    hand_value = session_log.get_hand_value(screen_area, db)
    combination_value = db_query.get_combination_value('flop', hand_value, db)
    stack = session_log.get_last_row_from_log_session(screen_area, db)[0][1]
    if hand_value is None:
        return False
    opponent_reaction = image_processing.search_last_opponent_action(
        screen_area, db)
    if not isinstance(opponent_reaction, str):
        opponent_reaction = opponent_reaction['alias']
    if opponent_reaction in ('1', '2', '3') and combination_value in ('draw', 'other', 'composite') \
            and int(stack) <= 13 and current_stack.search_current_stack(screen_area, stack_collection, db) <= 13:
        keyboard.press('q')
        session_log.update_action_log_session('push', str(screen_area), db)
    elif combination_value == 'draw' and pot_odds.check_is_call_valid(
            screen_area, hand_value, 'turn', stack_collection, db):
        keyboard.press('c')
        session_log.update_action_log_session('cc_postflop', str(screen_area),
                                              db)
    elif opponent_reaction in ('1', '2') and hand_value not in (
            'trash', 'gutshot', 'bottom_pair',
            'over_cards') and combination_value != 'draw':
        keyboard.press('c')
        session_log.update_action_log_session('cc_postflop', str(screen_area),
                                              db)
    elif opponent_reaction == 'check':
        keyboard.press('h')
        session_log.update_action_log_session('cc_postflop', str(screen_area),
                                              db)
    else:
        keyboard.press('f')
        session_log.update_action_log_session('fold', str(screen_area), db)
    return True
Exemple #2
0
def make_river_decision(screen_area, hand, stack, action, stack_collection, db):
    opponent_reaction = image_processing.search_last_opponent_action(screen_area, db)
    hand_value = flop.get_hand_value(hand, screen_area, db)
    combination_value = db_query.get_combination_value('river', hand_value, db)
    if not isinstance(opponent_reaction, str):
        opponent_reaction = opponent_reaction['alias']
    if river_action(screen_area, hand_value, combination_value, stack, action, opponent_reaction, hand, stack_collection, db):
        return True
Exemple #3
0
def check_is_raise_cbet(screen_area, stack_collection, db):
    hand_value = session_log.get_hand_value(screen_area, db)
    combination_value = db_query.get_combination_value('flop', hand_value, db)
    opponent_reaction = image_processing.search_last_opponent_action(screen_area, db)
    stack = session_log.get_last_row_from_log_session(screen_area, db)[0]['current_stack']
    if not isinstance(opponent_reaction, str):
        opponent_reaction = opponent_reaction['alias']
    if raise_cbet_action(screen_area, hand_value, combination_value, opponent_reaction, stack, stack_collection, db):
        return True
Exemple #4
0
def make_flop_decision(screen_area, hand, image_name, folder_name, stack,
                       action, is_headsup, flop_deck, stack_collection, db):
    try:
        save_flop_image(screen_area, image_name, folder_name, db)
        flop_area = db_query.get_flop_area(screen_area, db)
        flop_card = image_processing.search_cards(str(flop_area), flop_deck, 6,
                                                  db)
        hand = hand + flop_card
        opponent_reaction = image_processing.search_last_opponent_action(
            screen_area, db)
        if not isinstance(opponent_reaction, str):
            opponent_reaction = opponent_reaction['alias']
        session_log.update_hand_after_flop(str(screen_area), hand, db)
        hand_value = get_hand_value(hand, screen_area, db)
        combination_value = db_query.get_combination_value(
            'flop', hand_value, db)
        flop_action(screen_area, action, hand_value, combination_value, stack,
                    is_headsup, opponent_reaction, stack_collection, db)
    except Exception as e:
        error_log.error_log('makeFlopDecision' + action, str(e))
        print(e)