Building a 9-ball AI player: Candidate generation for direct cut shots [P]
Summary
A developer is building an AI player for 9-ball pool to optimize pattern play by selecting shots based on success probability and favorable subsequent positions. The system integrates a Transformer-based model to predict win probability from table layouts, a candidate shot generator for various shot types (cut, bank, kick, carom, combination, safeties), and an evaluator that uses the win probability model. To overcome the computational expense of the `pooltool` physics simulator, which takes 5-15 ms per shot, the developer implemented a faster evaluation method. This involves pre-computed "Acceptance window" and "Shot-index" lookup tables, complemented by a small, 50k-parameter MLP "throw model" that generalizes shot data into continuous space. This approach achieves a 10,000x speedup for candidate evaluation, reducing 1000 candidate shots from 10 seconds to 1 ms, and an overall 50-100x speedup for end-to-end shot selection.
Key takeaway
For AI Engineers developing agents in physics-rich environments, consider a hybrid approach that combines pre-computed physics lookups and small, specialized ML models with full physics simulations. Your team can achieve significant computational speedups (e.g., 50-100x end-to-end) by using ML for rapid candidate generation and filtering, reserving expensive physics simulations only for final validation of promising options. This strategy allows for extensive self-play data generation and faster model iteration.
Key insights
Hybrid AI systems combining physics simulation with ML models can drastically accelerate complex decision-making.
Principles
- Decompose complex actions into sub-problems.
- Pre-compute static physics for dynamic systems.
- Use ML to generalize discrete physics data.
Method
The method involves pre-computing shot acceptance windows and shot indices, then training a small MLP "throw model" to generalize shot parameters. This enables rapid batch evaluation of candidate shots on GPUs, followed by physics-based validation of top candidates.
In practice
- Pre-compute lookup tables for fixed physics.
- Train small MLPs for continuous generalization.
- Use noisy simulations for robust shot selection.
Topics
- 9-ball AI Player
- Candidate Shot Generation
- Billiards Simulation
- Transformer Model
- Multilayer Perceptron
Best for: Machine Learning Engineer, AI Engineer, AI Scientist
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by Machine Learning.