Beispiel #1
0
def check_is_cbet_available(screen_area, db):
    element_area = introduction.save_element(screen_area, 'limp_area', db)
    path = db_query.get_last_screen(element_area, db)
    path = path[0]['image_path']
    img_rgb = cv2.imread(path, 0)
    template_path = 'action_buttons/check.png'
    if cv_data_template(template_path, img_rgb) > 0:
        return True
Beispiel #2
0
def search_last_opponent_action(screen_area, db):
    element_area = introduction.save_element(screen_area, 'limp_area', db)
    path = db_query.get_last_screen(element_area, db)
    path = path[0]['image_path']
    img_rgb = cv2.imread(path, 0)
    for item in db_query.get_actions_buttons(db):
        if cv_data_template(item['image_path'], img_rgb) > 0:
            return item
    return 'push'
Beispiel #3
0
def check_is_turn(screen_area, deck, stack_collection, db):
    element_area = introduction.save_element(screen_area, 'turn_area', db)
    if image_processing.search_element(element_area, ['turn'], 'green_board/', db) is False:
        if len(session_log.get_actual_hand(screen_area, db)) == 10:
            turn = image_processing.search_cards(element_area, deck, 2, db)
            session_log.update_hand_after_turn(str(screen_area), turn, db)
        last_row = session_log.get_last_row_from_log_session(screen_area, db)
        hand = last_row[0][0]
        stack = current_stack.get_actual_game_data(screen_area, stack_collection, db)
        if make_turn_decision(screen_area, hand, stack, stack_collection, db):
            return True
    return False
Beispiel #4
0
def check_is_river(screen_area, deck, stack_collection, db):
    element_area = introduction.save_element(screen_area, 'river_area', db)
    if image_processing.search_element(element_area, ['river'], 'green_board/',
                                       db) is False:
        if len(session_log.get_actual_hand(screen_area, db)) == 12:
            river = image_processing.search_cards(element_area, deck, 2, db)
            session_log.update_hand_after_turn(str(screen_area), river, db)
        last_row = session_log.get_last_row_from_log_session(screen_area, db)
        hand = last_row[0][0]
        stack = last_row[0][1]
        action = last_row[0][3]
        if make_river_decision(screen_area, hand, stack, action,
                               stack_collection, db):
            return True
    return False