Ejemplo n.º 1
0
def test_preflop_sheet_utgX_range():
    log = logging.getLogger(__name__)
    preflop_state = CurrentHandPreflopState()
    h = History()
    preflop_url = get_dir(os.path.join('tools', 'preflop.xlsx'))
    h.preflop_sheet = pd.read_excel(preflop_url, sheet_name=None)
    preflop_state.reset()
    for i in range(5):
        sheet_name = str(i + 1)
        ranges = preflop_state.get_rangecards_from_sheetname1(sheet_name, h)
        combos1 = mc_get_opponent_combos(opponent_range=ranges)
        log.info(f'{ranges}')
        log.info(f'UTG {i} : {len(combos1)}')
Ejemplo n.º 2
0
def test_reverse_sheetname():
    log = logging.getLogger(__name__)
    # Get table_dict
    table_scraper_name = 'GG_6TABLE'
    table_dict = mongo.get_table(table_scraper_name)
    # Mock signal
    gui_signals = MagicMock()
    # Game logger
    game_logger = GameLogger()

    preflop_state = CurrentHandPreflopState()
    h = History()

    preflop_url = get_dir(os.path.join('tools', 'preflop.xlsx'))
    # mongoclient = MongoClient(f'mongodb://*****:*****@dickreuter.com/neuron_poker')
    # mongodb = mongoclient.neuron_poker
    # cursor = mongodb.internal.find()
    # c = cursor.next()
    # preflop_url = c['preflop_url']
    # log.info(f'preflop_url: {preflop_url}')
    h.preflop_sheet = pd.read_excel(preflop_url, sheet_name=None)
    p = StrategyHandler()
    p.read_strategy()  # Read default strategy.
    t = TableScreenBased(p, table_dict, gui_signals, game_logger, 0.0)
    t.dealer_position = 4
    t.position_utg_plus = t.get_utg_from_abs_pos(0, t.dealer_position)  # 5

    preflop_state.reset()
    # preflop_state.other_players = deepcopy(t.other_players)
    preflop_state.bot_preflop_position_utg = t.position_utg_plus  # 5
    preflop_state.bot_preflop_decision = 'Bet'
    preflop_state.preflop_raiser_positions.append(5)
    # preflop_state.preflop_raiser_positions.append(4)
    # preflop_state.preflop_caller_positions.append(5)
    preflop_state.rounds = 0

    for abs_pos in [5]:
        sheet_name = preflop_state.get_reverse_sheetname(abs_pos, t, h)
        log.info(f'abs_pos:{abs_pos}, sheet_name: {sheet_name}')
        ranges = preflop_state.get_rangecards_from_sheetname(
            abs_pos, sheet_name, t, h, p)
        log.info(f'{ranges}')