Agent skill
ai-opponent
Implement or tune AI opponent behavior
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/ai-opponent
SKILL.md
AI Opponent Implementation
Help implement or tune AI opponent logic per the game design.
AI Strategy (from design doc)
func chooseAcceleration(racer: Player, track: Track, opponents: [Player]) -> GridVector {
var bestScore = Int.min
var bestAccel = GridVector(0, 0)
for acceleration in allAccelerations {
let newPos = racer.position + racer.velocity + acceleration
let newVel = racer.velocity + acceleration
if wouldCrash(from: racer.position, to: newPos, track: track) {
score = -1000
} else {
score = progressTowardFinish(newPos, track.finishLine)
score -= distanceToTrackCenter(newPos, track) * 0.1
score -= speed(newVel) * 0.05 // Prefer control
}
if score > bestScore {
bestScore = score
bestAccel = acceleration
}
}
return bestAccel
}
Difficulty Levels
| Level | Behavior |
|---|---|
| Easy | Random valid moves, avoids crashes |
| Medium | Greedy progress toward finish |
| Hard | Looks 2-3 moves ahead, blocks opponents |
Implementation Tasks
- Basic AI: Avoid crashes, prefer forward progress
- Path scoring: Evaluate each of 9 options
- Lookahead: Simulate N turns ahead (Hard mode)
- Opponent awareness: Block or avoid collisions
- Track awareness: Prefer center of track
Testing
- AI should never choose crash moves when safe options exist
- Easy AI should lose to competent player
- Hard AI should provide challenge
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?