War of Dots

A territory game on a grid: place your dots in turn, surround the other player's, and the dots you enclose are yours. Play against an AI that learned the game by playing itself, on an Android phone or on Windows.

A game of War of Dots on a phone against Expert: the blue player surrounds a group of red dots, captures them and the score jumps to 7.
  • Android and Windows
  • 3 computer opponents, from Easy to Expert
  • 294 automated tests on the rules and the app

What makes the game work

Captures you can trust

Every capture is computed exactly, so the same loop always takes the same dots.

The end of a game: You won, with 11 dots captured against Hard's 7, and buttons to play again, replay or see the board.

An opponent at your level

Easy while you learn, Hard for a patient game, and Expert, the trained network, which runs on the phone itself. Switch any time and the new opponent carries on from the same position.

The choose-opponent sheet: Easy, Hard, Expert and Two players, with Hard selected.

Every game kept

Your history lists each game with its result, and any of them can be replayed move by move.

The game history: past games against Expert with their board size, number of moves and result.

Training that fits on one machine

The AI learns by playing against itself on a single graphics card, and it now learns 3.5 times faster.

New models earn their place

A new version replaces the old one only when it wins by a statistically significant margin.

How it's built

It started as a college assignment. The game is easy to explain and hard to get right, so I kept coming back to it.

Rules engine
C++17, shared by the app and the training code
App
Kotlin and Compose Multiplatform, for Android and Windows
Search
Minimax with alpha-beta, and AlphaZero-style tree search
Model
One policy and value network for every board size, trained with PyTorch on CUDA

Need a game AI that plays well, or software that runs faster? Tell me where it's slow.

Ask about performance work