Add high-inning preference for AI lineups

This commit is contained in:
Cal Corum 2024-02-24 23:34:36 -06:00
parent 1f917b8a6b
commit ac14e8517e
2 changed files with 11 additions and 3 deletions

View File

@ -28,7 +28,7 @@ logging.basicConfig(
CARDSETS = { CARDSETS = {
'ranked': { 'ranked': {
'primary': [9, 10, 13, 14, 15] # 2023, 23 Promos, 2018 'primary': [9, 10, 13, 14] # 2023, 23 Promos, 2018
}, },
'minor-league': { 'minor-league': {
'primary': [13, 8], # 2018, Mario 'primary': [13, 8], # 2018, Mario

View File

@ -198,6 +198,10 @@ def get_scouting_dfs(allowed_players, position: str):
dict([(x.player.player_id, x.error) for x in positions]), dict([(x.player.player_id, x.error) for x in positions]),
name=f'Error {position}' name=f'Error {position}'
)) ))
series_list.append(pd.Series(
dict([(x.player.player_id, x.innings) for x in positions]),
name=f'Innings {position}'
))
if position in ['LF', 'CF', 'RF']: if position in ['LF', 'CF', 'RF']:
series_list.append(pd.Series( series_list.append(pd.Series(
dict([(x.player.player_id, x.arm) for x in positions]), dict([(x.player.player_id, x.arm) for x in positions]),
@ -374,10 +378,14 @@ async def get_team_lineup(team_id: int, difficulty_name: str, pitcher_name: str,
r_mod = (3 - df_data[f'Range {position}']) * r_mult r_mod = (3 - df_data[f'Range {position}']) * r_mult
e_mod = df_data[f'Error {position}'] * e_mult e_mod = df_data[f'Error {position}'] * e_mult
i_mult = df_data[f'Innings {position}'] / 1000
# final_ops = df_data['total_OPS'] + r_mod + e_mod
# final_ops = (df_data['total_OPS'] * i_mult) + r_mod + e_mod
final_ops = (df_data['total_OPS'] + r_mod + e_mod) * i_mult
logging.debug(f'{df_data.player_name} total OPS: {df_data.total_OPS} / ' logging.debug(f'{df_data.player_name} total OPS: {df_data.total_OPS} / '
f'final OPS: {df_data.total_OPS + r_mod + e_mod}') f'final OPS: {final_ops}')
return df_data['total_OPS'] + r_mod + e_mod return final_ops
if len(eligible_cards.index) >= 1: if len(eligible_cards.index) >= 1:
eligible_cards['final_ops'] = eligible_cards.apply(rank_cards, axis=1) eligible_cards['final_ops'] = eligible_cards.apply(rank_cards, axis=1)