Cleanup: remove tracked pycache files, update .gitignore, finalize refactor deletions
This commit is contained in:
parent
7e49a1b502
commit
077d7a7783
16 changed files with 6 additions and 261 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -8,5 +8,10 @@ obs_exports/
|
|||
# Python cache
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
career_stats.json
|
||||
final_db.json
|
||||
data/*.db
|
||||
*.db
|
||||
|
||||
career_stats.json
|
||||
final_db.json
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
145
storylines.py
145
storylines.py
|
|
@ -1,145 +0,0 @@
|
|||
from rankings import load_career_db
|
||||
from tags.objective_domination import (
|
||||
compute_dom_objective_for_career_player,
|
||||
compute_dom_objective_for_match_player,
|
||||
compute_dom_objective_team_scores
|
||||
)
|
||||
|
||||
|
||||
def matchup_storyline(teamA_players, teamB_players):
|
||||
"""
|
||||
Composition-aware storyline generator.
|
||||
Accepts two lists of player entries (5 per team).
|
||||
"""
|
||||
|
||||
if not teamA_players or not teamB_players:
|
||||
return "Not enough selected players to generate a storyline."
|
||||
|
||||
# --- Helper averages ---
|
||||
def avg_slayer(players):
|
||||
return sum(p.get("slayer_score_raw", 0.0) for p in players) / max(1, len(players))
|
||||
|
||||
def avg_obj_payload(players):
|
||||
return sum(
|
||||
p.get("objective_payload_components", {}).get("payload_score_raw", 0.0)
|
||||
for p in players
|
||||
) / max(1, len(players))
|
||||
|
||||
def avg_sharp(players):
|
||||
return sum(
|
||||
p.get("sharpshooter_components", {}).get("accuracy_norm", 0.0)
|
||||
for p in players
|
||||
) / max(1, len(players))
|
||||
|
||||
def avg_obj_dom(players):
|
||||
return sum(
|
||||
compute_dom_objective_for_career_player(
|
||||
p.get("career_entry", {})
|
||||
).get("dom_score_raw", 0.0)
|
||||
for p in players
|
||||
) / max(1, len(players))
|
||||
|
||||
def avg_consistency(players):
|
||||
return sum(
|
||||
p.get("consistency_components", {}).get("consistency_norm", 0.0)
|
||||
for p in players
|
||||
) / max(1, len(players))
|
||||
|
||||
def avg_clutch(players):
|
||||
return sum(
|
||||
p.get("clutch_components", {}).get("clutch_norm", 0.0)
|
||||
for p in players
|
||||
) / max(1, len(players))
|
||||
|
||||
|
||||
|
||||
# --- Compute team averages ---
|
||||
a_slayer = avg_slayer(teamA_players)
|
||||
b_slayer = avg_slayer(teamB_players)
|
||||
|
||||
a_obj = avg_obj_payload(teamA_players)
|
||||
b_obj = avg_obj_payload(teamB_players)
|
||||
|
||||
a_sharp = avg_sharp(teamA_players)
|
||||
b_sharp = avg_sharp(teamB_players)
|
||||
|
||||
a_dom = avg_obj_dom(teamA_players)
|
||||
b_dom = avg_obj_dom(teamB_players)
|
||||
|
||||
a_consistency = avg_consistency(teamA_players)
|
||||
b_consistency = avg_consistency(teamB_players)
|
||||
|
||||
a_clutch = avg_clutch(teamA_players)
|
||||
b_clutch = avg_clutch(teamB_players)
|
||||
|
||||
# --- Team names ---
|
||||
team_a = teamA_players[0].get("team", "Team A")
|
||||
team_b = teamB_players[0].get("team", "Team B")
|
||||
|
||||
# --- Build storyline ---
|
||||
lines = []
|
||||
lines.append(f"MATCH STORYLINE — {team_a} vs {team_b}\n")
|
||||
|
||||
# Slayer storyline
|
||||
if a_slayer > b_slayer:
|
||||
lines.append(f"{team_a} bring stronger slaying on paper.")
|
||||
elif b_slayer > a_slayer:
|
||||
lines.append(f"{team_b} bring stronger slaying on paper.")
|
||||
else:
|
||||
lines.append("Slaying power looks evenly matched.")
|
||||
|
||||
# Payload storyline
|
||||
if a_obj > b_obj:
|
||||
lines.append(f"{team_a} have the edge in Payload objective presence.")
|
||||
elif b_obj > a_obj:
|
||||
lines.append(f"{team_b} have the edge in Payload objective presence.")
|
||||
else:
|
||||
lines.append("Payload objective presence looks evenly matched.")
|
||||
|
||||
# Domination storyline
|
||||
if a_dom > b_dom:
|
||||
lines.append(f"{team_a} show stronger Domination objective capability.")
|
||||
elif b_dom > a_dom:
|
||||
lines.append(f"{team_b} show stronger Domination objective capability.")
|
||||
else:
|
||||
lines.append("Domination objective capability looks evenly matched.")
|
||||
|
||||
|
||||
# Consistency storyline
|
||||
if a_consistency > b_consistency:
|
||||
lines.append(f"{team_a} bring steadier map-to-map performance.")
|
||||
elif b_consistency > a_consistency:
|
||||
lines.append(f"{team_b} bring steadier map-to-map performance.")
|
||||
else:
|
||||
lines.append("Both teams show similar consistency across maps.")
|
||||
|
||||
# Clutch Storyline
|
||||
if a_clutch > b_clutch:
|
||||
lines.append(f"{team_a} show stronger clutch performance in high-pressure moments.")
|
||||
elif b_clutch > a_clutch:
|
||||
lines.append(f"{team_b} show stronger clutch performance in high-pressure moments.")
|
||||
else:
|
||||
lines.append("Both teams show similar clutch performance.")
|
||||
|
||||
|
||||
# Sharpshooter storyline
|
||||
sharp_delta = a_sharp - b_sharp
|
||||
sharp_pct = sharp_delta * 100
|
||||
|
||||
if sharp_delta > 0.02:
|
||||
lines.append(
|
||||
f"{team_a} bring a Sharpshooter Advantage of {sharp_pct:.1f}%, "
|
||||
f"landing more shots and converting more headshots than {team_b}."
|
||||
)
|
||||
elif sharp_delta < -0.02:
|
||||
lines.append(
|
||||
f"{team_b} hold a Sharpshooter Edge of {abs(sharp_pct):.1f}%, "
|
||||
f"which could punish {team_a} in long‑range duels."
|
||||
)
|
||||
else:
|
||||
lines.append(
|
||||
"Both teams are evenly matched in Sharpshooting, so aim consistency "
|
||||
"won’t be a deciding factor unless someone pops off."
|
||||
)
|
||||
|
||||
return "\n".join(lines)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
115
team_identity.py
115
team_identity.py
|
|
@ -1,115 +0,0 @@
|
|||
from rankings import load_career_db
|
||||
from tags.objective_domination import (
|
||||
compute_dom_objective_for_career_player,
|
||||
compute_dom_objective_for_match_player,
|
||||
compute_dom_objective_team_scores
|
||||
)
|
||||
|
||||
|
||||
def generate_team_identity(player_list):
|
||||
"""
|
||||
Returns a dictionary of team identity scores based on the average
|
||||
identity-tag components of the SELECTED PLAYERS ONLY.
|
||||
"""
|
||||
|
||||
if not player_list:
|
||||
return None
|
||||
|
||||
# --- Helper functions for each identity tag ---
|
||||
def avg_slayer(players):
|
||||
return sum(p.get("slayer_score_raw", 0.0) for p in players) / max(1, len(players))
|
||||
|
||||
def avg_payload(players):
|
||||
return sum(
|
||||
p.get("objective_payload_components", {}).get("payload_score_raw", 0.0)
|
||||
for p in players
|
||||
) / max(1, len(players))
|
||||
|
||||
def avg_consistency(players):
|
||||
return sum(
|
||||
p.get("consistency_components", {}).get("consistency_norm", 0.0)
|
||||
for p in players
|
||||
) / max(1, len(players))
|
||||
|
||||
def avg_clutch(players):
|
||||
return sum(
|
||||
p.get("clutch_components", {}).get("clutch_norm", 0.0)
|
||||
for p in players
|
||||
) / max(1, len(players))
|
||||
|
||||
def avg_sharp(players):
|
||||
return sum(
|
||||
p.get("sharpshooter_components", {}).get("accuracy_norm", 0.0)
|
||||
for p in players
|
||||
) / max(1, len(players))
|
||||
|
||||
def avg_objdom(players):
|
||||
return sum(
|
||||
compute_dom_objective_for_career_player(
|
||||
p.get("career_entry", {})
|
||||
).get("dom_score_raw", 0.0)
|
||||
for p in players
|
||||
) / max(1, len(players))
|
||||
|
||||
# --- Compute identity scores ---
|
||||
identity = {
|
||||
"slayer_score": avg_slayer(player_list),
|
||||
"payload_score": avg_payload(player_list),
|
||||
"consistency_score": avg_consistency(player_list),
|
||||
"clutch_score": avg_clutch(player_list),
|
||||
"sharpshooter_score": avg_sharp(player_list),
|
||||
"objdom_score": avg_objdom(player_list),
|
||||
}
|
||||
|
||||
return identity
|
||||
|
||||
|
||||
def compare_team_identity(teamA_players, teamB_players):
|
||||
a = generate_team_identity(teamA_players)
|
||||
b = generate_team_identity(teamB_players)
|
||||
|
||||
if a is None or b is None:
|
||||
return "Not enough data to generate team identity comparison."
|
||||
|
||||
team_a_name = teamA_players[0].get("team", "Team A")
|
||||
team_b_name = teamB_players[0].get("team", "Team B")
|
||||
|
||||
summary = []
|
||||
|
||||
# --- Slayer ---
|
||||
if a["slayer_score"] > b["slayer_score"]:
|
||||
summary.append(f"{team_a_name} lean slayer-heavy.")
|
||||
elif b["slayer_score"] > a["slayer_score"]:
|
||||
summary.append(f"{team_b_name} lean slayer-heavy.")
|
||||
|
||||
# --- Payload Objective ---
|
||||
if a["payload_score"] > b["payload_score"]:
|
||||
summary.append(f"{team_a_name} show stronger Payload objective focus.")
|
||||
elif b["payload_score"] > a["payload_score"]:
|
||||
summary.append(f"{team_b_name} show stronger Payload objective focus.")
|
||||
|
||||
# --- Domination Objective ---
|
||||
if a["objdom_score"] > b["objdom_score"]:
|
||||
summary.append(f"{team_a_name} show stronger Domination objective presence.")
|
||||
elif b["objdom_score"] > a["objdom_score"]:
|
||||
summary.append(f"{team_b_name} show stronger Domination objective presence.")
|
||||
|
||||
# --- Consistency ---
|
||||
if a["consistency_score"] > b["consistency_score"]:
|
||||
summary.append(f"{team_a_name} are the steadier team.")
|
||||
elif b["consistency_score"] > a["consistency_score"]:
|
||||
summary.append(f"{team_b_name} are the steadier team.")
|
||||
|
||||
# --- Clutch ---
|
||||
if a["clutch_score"] > b["clutch_score"]:
|
||||
summary.append(f"{team_a_name} excel in clutch situations.")
|
||||
elif b["clutch_score"] > a["clutch_score"]:
|
||||
summary.append(f"{team_b_name} excel in clutch situations.")
|
||||
|
||||
# --- Sharpshooter ---
|
||||
if a["sharpshooter_score"] > b["sharpshooter_score"]:
|
||||
summary.append(f"{team_a_name} bring stronger aim and headshot conversion.")
|
||||
elif b["sharpshooter_score"] > a["sharpshooter_score"]:
|
||||
summary.append(f"{team_b_name} bring stronger aim and headshot conversion.")
|
||||
|
||||
return " ".join(summary)
|
||||
Loading…
Reference in a new issue