skills/tabular/opponent-avoidance-scoring/SKILL.md
Score candidate movement directions by average distance to nearby opponents and pick the safest path for ball-carrying agents in game AI
npx skillsauth add wenmin-wu/ds-skills tabular-opponent-avoidance-scoringInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
When an agent controls the ball in a game AI, choosing which direction to advance requires evaluating opponent density ahead. Score each candidate direction (right, top-right, bottom-right) by the average distance to opponents in that sector. Pick the direction with the greatest average distance — or trigger a long pass if all directions are blocked (too many opponents nearby).
import numpy as np
def avg_distance_to_opponents(obs, target_x, target_y):
opponents = obs["right_team"]
dists = [np.sqrt((ox - target_x)**2 + (oy - target_y)**2) for ox, oy in opponents]
nearby = [d for d in dists if d < 0.05]
return np.mean(nearby) if nearby else 2.0, len(nearby)
def pick_direction(obs, player_x, player_y):
directions = {
"right": (player_x + 0.01, player_y),
"top_right": (player_x + 0.01, player_y - 0.01),
"bottom_right": (player_x + 0.01, player_y + 0.01),
}
best_dir, best_dist = "right", 0
total_nearby = 0
for name, (tx, ty) in directions.items():
dist, count = avg_distance_to_opponents(obs, tx, ty)
total_nearby += count
if dist > best_dist:
best_dist = dist
best_dir = name
if total_nearby >= 3:
return "high_pass" # surrounded — clear the ball
return best_dir
data-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF