AI for Ouk Chaktrang
ITC, Cambodia
Designed an AI that teaches itself to play Cambodian chess, AlphaZero-style, during my international mobility in Phnom Penh.
- faster move generation on GPU
- 233×
- faster move generation on GPU
- estimated training time
- 77 → 29 d
- estimated training time
- score vs Minimax
- 0.60 → 0.80
- score vs Minimax
Overview
During my international mobility at the ViLa Lab of the Institute of Technology of Cambodia (ITC), I designed an artificial intelligence able to learn to play Ouk Chaktrang, Cambodian chess, with no prior human knowledge. Most pieces have a short range, so the scoring tables and heuristics of Western chess do not apply. After comparing Minimax with alpha-beta pruning, Monte-Carlo Tree Search (MCTS) and reinforcement learning, I chose the approach popularized by AlphaZero: an MCTS search guided by a neural network trained only by playing against itself. The project also includes a web application to play against the AI, collect human games and drive training.
Key features
- MCTS-PUCT search guided by a residual policy/value network of about 838,000 parameters
- Self-learning loop: self-play, training, then acceptance arena
- GPU-vectorized game engine: hundreds of games in parallel
- Continuous evaluation against fixed opponents (random, Minimax, pure MCTS) and Bradley-Terry ranking
- Automatic per-phase resume and migration of a campaign between machines
- FastAPI + MongoDB + Vue.js web app: play vs AI, multiplayer, live training monitoring
- Model fine-tuning on games played by humans
Context
International mobility of my engineering program, from July 6 to September 4, 2026, at the ViLa Lab, part of the Information and Communication Engineering department of the Institute of Technology of Cambodia (ITC) in Phnom Penh. I worked in English alongside other students, starting from an existing chess AI prototype that I adapted and specialized for Ouk Chaktrang.
What I did
- Studied and compared three algorithm families (Minimax with alpha-beta, pure MCTS, guided reinforcement learning) and justified the architecture choice.
- Ported the rules engine from JavaScript to Python, validated on 163 parity positions, and fixed structural defects (shallow board copy, no-progress draw rule).
- Fixed a defect that mathematically capped the arena score at 0.50 and prevented any new network from being accepted, which unblocked the learning loop.
- Rewrote the engine and search as vectorized PyTorch code, validated move by move against the sequential engine: move generation 233 times faster than on CPU, 42 times more simulations per second.
- Optimizations (mixed precision, legality caching, mirror augmentation, replay window) and a measured cost model: estimated duration of a 200-iteration campaign cut from 77 to 29 days.
- Ran a training campaign on shared GPUs limited to 48 consecutive hours, with automatic resume and migration across three machines.
- Wrote a research report and a handover documentation in English, then presented the results to a non-specialist audience.
Lessons learned
- Measure rather than assume: a first estimate that was off by a factor of almost two was replaced by a cost model built on a real iteration.
- Progress must be proven: against the reference Minimax opponent, the AI's score rose from 0.60 to 0.80 over the campaign.
- Systematic testing (rules parity, cross-validation of the engines) revealed defects that ran without any visible error.
- Working in English, in a different work culture, taught me to tell real urgency from self-imposed urgency. The lab kept the code that generates and trains the models.