Ejemplo n.º 1
0
def first_round_at_preflop():
    """ 
    This function is created to help handling the bot after the game is
    unpaused in 'I_AM_PLAYING' bot status.
    If I've resume the game, set c.bot_status = 'WAITING_FOR_FIRST_HAND'
    inside resume function.
    Even at preflop (betting_round = 0) (first_round_at_preflop() is True) 
    I can resume the game without doing set_just_do_check_fold_to_true().
    """
    def is_there_any_raiser():
        """ Except me """
        for seat in range(1, c.TOTAL_SEATS+1):
            if seat == c.my_seat_number:
                continue
            elif red_chips(seat):
                return True
        return False

    if not pm.pre_flop_pixel(c.game_position):
        return False 
    if is_there_any_raiser():
        shout('doing some ocr to check if it is first_round_at_preflop or not')
        if c.my_seat_number in (c.big_blind_seat, c.big_blind_seat):
            if ocr_bet(c.my_seat_number) > c.BLIND_VALUE:
                return False
        else:
            if pm.player_chips_pixel(c.game_position, c.my_seat_number):
                return False
    return True
Ejemplo n.º 2
0
def white_chips(seat):
    # It checks if there is a white colored chips in front of a seat,
    # by returning True or False, to find out if a player has call or not
    #global game_position

    if pm.player_chips_pixel(config.game_position, seat):
        return not pm.are_chips_white_or_red_pixel(config.game_position, seat)
    else:
        return False
Ejemplo n.º 3
0
def red_chips(seat):
    # It checks if there is a red colored chips in front of a seat,
    # by returning True or False, to find out if a player has bet/raised or not.
    # (In accordance to Google: 'A bet is the first wager of a round.')
    #global game_position

    if pm.player_chips_pixel(config.game_position, seat):
        return pm.are_chips_white_or_red_pixel(config.game_position, seat)
    else:
        return False
Ejemplo n.º 4
0
def report_the_player(seat_to_report):
    #global seats_not_folded
    if not pm.player_cards_pixel(c.game_position, seat_to_report):
        c.seats_not_folded[seat] = False
        shout('Seat %s has folded' % seat_to_report, color='light_cyan')
    elif not pm.player_chips_pixel(c.game_position, seat_to_report):
        shout('Seat %s has checked' % seat_to_report, color='light_cyan')
    # It happens for big blind seat at preflop stage.
    elif (not pm.are_chips_white_or_red_pixel(c.game_position, seat_to_report)
          and seat_to_report == c.big_blind_seat):
        shout('Seat %s has checked' % seat_to_report, color='light_cyan')
    elif not pm.are_chips_white_or_red_pixel(c.game_position, seat_to_report):
        shout('Seat %s has called' % seat_to_report, color='light_cyan')
    elif pm.are_chips_white_or_red_pixel(c.game_position, seat_to_report):
        bet = ocr_bet(seat_to_report)
        shout('Seat %s has raised %s' % (seat_to_report, bet),
              color='light_cyan')
def test_pixel_matching():

    # This list may differ for other websites
    ALL_CLICK_NAMES = [
        'fold',
        'check',
        'call',
        'bet',
        'raise',
        'plus',
        'minus',
        'all_in',
        #'available_seat_1', 'available_seat_2', 'available_seat_3',
        #'available_seat_4', 'available_seat_5',
        'exit',
        'exit_yes',
        'menu',
        'rebuy_menu',
        'leave_next_hand_ok',
        'buy_in',
        'buy_in_plus',
        'buy_in_minus',
        're_buy',
        're_buy_plus',
        're_buy_minus',
        'i_am_back',
        #'exit_probable_advertisement', 'close_update_window',
    ]

    print('\n***testing pixel matching for buttons:***')

    for button_name in ALL_CLICK_NAMES:
        print('%s button pixel is: %s' %
              (button_name, pm.button_pixel(game_position, button_name)))
    for seat in range(1, TOTAL_SEATS + 1):
        print('available_seat_%s button pixel is: %s' %
              (seat, pm.available_seat_pixel(game_position, seat)))

    print('\n***testing pixel matching for non buttons:***')

    print('pre_flop_pixel is: %s' % pm.pre_flop_pixel(game_position))
    print('flop_pixel is: %s' % pm.flop_pixel(game_position))
    print('turn_pixel is: %s' % pm.turn_pixel(game_position))
    print('river_pixel is: %s' % pm.river_pixel(game_position))
    for seat in range(1, TOTAL_SEATS + 1):
        print('small_blind_pixel at seat %s is: %s' %
              (seat, pm.small_blind_pixel(game_position, seat)))
    for seat in range(1, TOTAL_SEATS + 1):
        print('big_blind_pixel at seat %s is: %s' %
              (seat, pm.big_blind_pixel(game_position, seat)))
    for seat in range(1, TOTAL_SEATS + 1):
        print('dealer_pixel at seat %s is: %s' %
              (seat, pm.dealer_pixel(game_position, seat)))
    for seat in range(1, TOTAL_SEATS + 1):
        print('player_chips_pixel at seat %s is: %s' %
              (seat, pm.player_chips_pixel(game_position, seat)))
    for seat in range(1, TOTAL_SEATS + 1):
        print('player_cards_pixel at seat %s is: %s' %
              (seat, pm.player_cards_pixel(game_position, seat)))
    for seat in range(1, TOTAL_SEATS + 1):
        print('other_player_seated_pixel at seat %s is: %s' %
              (seat, pm.other_player_seated_pixel(game_position, seat)))
    for seat in range(1, TOTAL_SEATS + 1):
        print('i_am_seated_pixel at seat %s is: %s' %
              (seat, pm.i_am_seated_pixel(game_position, seat)))
    for seat in range(1, TOTAL_SEATS + 1):
        print('active_player_pixel at seat %s is: %s' %
              (seat, pm.active_player_pixel(game_position, seat)))
    for seat in range(1, TOTAL_SEATS + 1):
        print('my_seat_won_pixel at seat %s is: %s' %
              (seat, pm.my_seat_won_pixel(game_position, seat)))
    for seat in range(1, TOTAL_SEATS + 1):
        print('other_seat_won_pixel at seat %s is: %s' %
              (seat, pm.other_seat_won_pixel(game_position, seat)))
    for seat in range(1, TOTAL_SEATS + 1):
        print('notification_banner_pixel at seat %s is: %s' %
              (seat, pm.notification_banner_pixel(game_position, seat)))
    for seat in range(1, TOTAL_SEATS + 1):
        print('are_chips_white_or_red_pixel at seat %s is: %s' %
              (seat, pm.are_chips_white_or_red_pixel(game_position, seat)))