All personal projects

STRATEGY GAME · PERSONAL PROJECT

FOUR

Play Connect Four against three self-trained opponents, a separate Pro solver or a friend.

Choose an opponent or play together on one device. Works on phones too.

FOUR during a two-player game, with red and yellow discs sitting behind the blue board face
Local two-player play. Discs fall behind the board face and settle into its holes.

One game, different ways to play

I built a self-play training application, then brought its saved neural models into a clear, responsive browser game. The same board supports a friend on one device, three trained opponents and a separate Pro solver, without a server making the moves.

Learned opponents, responsive play

Keep the board responsive while the AI thinks

The player’s disc appears while the AI calculates in a background Web Worker. Restarting cancels any calculation still in flight, and a game-generation check rejects old replies. A move from the previous game cannot land on the new board.

Bring trained models into the browser

Easy, Medium and Hard use three distinct saved networks from my self-play trainer, exported to ONNX for local inference. Easy samples the model’s policy; Medium and Hard add tree search guided by the model’s move scores and position estimates. Difficulty also changes search effort and move sampling.

Pro uses Benjamin Rall’s independent perfect-play solver, compiled to WebAssembly. It is a separate engine from my trained opponents.

Make the board feel physical

A perforated front face sits above the disc animation. The layout follows the same hole geometry on desktop and phones, while keyboard controls and reduced-motion play remain available.

What this work demonstrates

The work connects model training, browser inference and a finished game interface. Its reliability depends on details beyond choosing a move: showing progress, handling restarts and keeping calculations separate from interaction.

YOUR PROJECT

Need a tool with rules of its own?

If your project combines calculations or decisions with an interface people need to use, tell me what they should be able to do.