The project began as a Python-based server but quickly evolved into a hyper-optimized C++ engine. The core intelligence relies on three intersecting algorithms:

  1. Monte Carlo Tree Search (MCTS): Instead of hardcoded if/then rules, the snake simulates future moves using the Upper Confidence Bound applied to Trees (UCB1) formula to balance exploiting known good paths with exploring new strategies :

  2. Voronoi Spatial Evaluation: I implemented a Depth-First Search (DFS) using a flat 1D boolean array to calculate territory control. The board state is evaluated based on how many squares my snake can reach before any enemy snake can.

  3. A* Emergency Pathfinding: A strict dynamic starvation protocol triggers when health < distance_to_food + 5. The engine bypasses the MCTS and uses A* pathfinding to guarantee survival.

Built With

Share this project:

Updates