Reinforcement learning · Interactive systems
A transparent DQN for territory capture
A Flood-It agent moves from a categorical board representation to a deployed opponent that exposes the Q-value behind every available color.

- 46game win streak
- The trained policy against random opponents.
- 6discrete actions
- One Q-value for each board color.
- 3system layers
- Environment, inference service, and web client.
01 · Finding
Represent color as structure
Each board becomes an H × W × C one-hot tensor. Color identity stays categorical while the network can still learn which regions touch, expand, and threaten the opposing corner.
The six-color action space stays small, but useful play requires spatial planning rather than a reflexive preference for the largest immediate capture.

02 · Finding
Train the policy, then inspect it
The DQN learns from replayed transitions and produces a score for every color. Instead of hiding that vector behind a single move, the product surfaces it beside the board.
That decision trace turns the deployment into an inspection tool: visitors can see when the chosen move is decisive, marginal, or constrained by an invalid color.

03 · Finding
Correct perspective at the boundary
The trained model expected one corner, while a human opponent could occupy the mirrored side. The service corrects that mismatch by flipping the tensor before inference and mapping the decision back afterwards.
FastAPI and WebSockets keep the model state synchronized with a React client, preserving one source of game truth while moves and decision scores update in real time.
