All personal projects

BROWSER AI · PERSONAL PROJECT

AI Tic Tac Toe

A learning system you can train, test and inspect — entirely in your browser.

Choose Test vs random, then Train 10k and test again. Compare the X and O results in the training log, or step through a game. Opens in a new tab.

AI Tic Tac Toe interface with a board, training controls and model evaluation information
Training, direct play and evaluation share one interface, so the learner’s behaviour can be inspected.

Show the learning, not just the result

I built an agent that learns from the results of played games, together with an interface for exploring how its choices change. Visitors can train it as both X and O, inspect its move probabilities and play against the model they have just trained.

The challenge was to connect learning, evaluation and explanation in one usable tool: a changing score alone would reveal little about how the agent chooses a move.

From played games to a neural model

The rules establish legal moves and whether a game ends in a win, draw or loss. The learner records the final outcome against its own choices in an experience table. Random-opponent moves are excluded from those learning records.

I use that accumulated experience to train a neural network with two outputs: a policy that scores possible moves and a value that estimates the position’s outcome. Training targets come from played results, rather than minimax, labelled best moves or hand-written tactical rewards. This step transfers the table’s experience into the network, a process called distillation.

Neural only chooses from the network’s move scores. NN + honest experience combines those scores with the table’s recorded outcomes for the current position. Both modes restrict choices to legal moves.

Make experience count

A rotated or reflected board can represent the same decision. I fold the eight board symmetries into a shared representation, then map the chosen move back to the visible board. Equivalent positions share experience without supplying a strategy.

Exploration gives under-tested legal actions more chances. As evidence accumulates, repeatedly unsuccessful choices become less likely rather than being permanently banned. The training cycle includes self-play, extra exploratory self-play and games against random opponents with the learner in each playing position.

Compare the model without training it

Test vs random evaluates both modes and reports wins, draws and losses separately as X and O. Its score gives one point for a win and half a point for a draw. Separating the two positions makes differences visible that an overall score can hide.

Evaluation and AI-versus-AI observation do not update the network weights or add game outcomes to the experience table. The test measures play against random opponents; it does not establish perfect play.

Make the decisions inspectable

Visitors can watch automatic play or advance one move at a time. Optional probability bars show the current move-selection distribution, rather than a claimed chance of winning. Hiding them leaves a cleaner board for direct play.

I developed the learner, training loop, evaluation tools and frontend together. Training runs in batches that yield back to the interface, keeping controls and visible progress part of the same browser application.

YOUR PROJECT

Have a system people need to understand?

An interactive explanation can make a model, simulation or set of rules easier to inspect. Tell me what people need to explore and which decisions should be visible.