How ahmaddaghlas55/air_hokey_ml_testing- works
Autonomous Air Hockey runs a human-versus-robot match in a simulated table: the game loop reads table state, asks the robot strategy for a target, and advances the backend. The robot combines rule-based attack/defense with optional Q-table corrections and difficulty parameters. Logged player hits feed a player model and scripted training opponent; training produces a Q-table used at runtime and evaluated in headless matches. The README describes swapping in a hardware backend, but no hardware implementation is present. Some subsystem links are based on README documentation or the SOURCE INDEX rather than fully shown source.
Main entry points: sim_backend.py Simulation backend · strategy.py Robot strategy · evaluate.py Headless evaluator · train.py Residual RL trainer
Components 17
Match runtime
- Game loop
main.py - Simulation backend
sim_backend.py - Backend interface
interface.py - Physics world
physics_env.py
Robot policy
- Robot strategy
strategy.py - Trajectory predictor
predictor.py - Runtime Q policy
qpolicy.py - Difficulty parameters
difficulty.py
Player adaptation
- Player hit log
opponent_hits.jsonl - Player model builder
player_model.py - Player fingerprint
player_model.json - Scripted opponent
sim_opponent.py
Training and evaluation
- Residual Q-table
qtable.npy - Residual RL trainer
train.py - Headless evaluator
evaluate.py - Evaluation records
eval_results.jsonl
Other components
- Human player
Connections 25
- Human player → Simulation backend: controls paddle
README.md - Game loop → Simulation backend: reads state; sets target
main.py - Game loop → Robot strategy: requests target
main.py - Simulation backend → Backend interface: implements
sim_backend.py - Simulation backend → Physics world: steps; reads state
sim_backend.py - Simulation backend → Player hit log: appends hit records
sim_backend.py - Simulation backend → Trajectory predictor: previews trajectory
sim_backend.py - Robot strategy → Simulation backend: returns target
main.py - Robot strategy → Trajectory predictor: predicts intercept
strategy.py - Robot strategy → Runtime Q policy: requests correction
strategy.py - Runtime Q policy → Residual Q-table: loads and queries
qpolicy.py - Robot strategy → Difficulty parameters: uses presets
strategy.py - Player hit log → Player model builder: provides hit history
player_model.py - Player model builder → Player fingerprint: writes fingerprint
player_model.py - Player fingerprint → Difficulty parameters: informs difficulty
README.md - Player fingerprint → Scripted opponent: configures behavior
sim_opponent.py - Scripted opponent → Residual RL trainer: provides simulated play
train.py - Residual RL trainer → Physics world: runs episodes
train.py - Residual RL trainer → Robot strategy: uses classical plan
train.py - Residual RL trainer → Residual Q-table: warm-starts; saves
train.py - Headless evaluator → Physics world: runs matches
evaluate.py - Headless evaluator → Scripted opponent: evaluates against
evaluate.py - Headless evaluator → Robot strategy: uses classical plan
evaluate.py - Headless evaluator → Residual Q-table: reads table
evaluate.py - Headless evaluator → Evaluation records: appends records
README.md