2026-02-06
| 3 minutes
I like puzzle games, and one that I’ve always played in a rather mindless way, just to kill time, is the one called Flood It. Or Color Flood. But whatever you call it, it’s the one with a grid of random-colored squares where you start in one corner and keep flood-filling from there in different colors until you’ve flooded the entire board. The fewer moves you make, the higher your score.
But the more I’ve played it, the more curious I’ve become. What is the optimal strategy? Should you always flood as many squares as possible, or is it sometimes better to choose a smaller move to set up a bigger play? And if so, when?
Well, I don’t like just wondering about these things - I want to know. So I wrote a version of the game to help me find out. I call it FloodBoard.
◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇
To be clear, FloodBoard is not an AI solver. It doesn’t play the game for you. On the surface, it’s just a tool that lets you play the game in a terminal shell. (It also lets you choose how big a board you want to play on. )
But if you’re interested in taking the experience up a notch, you can also use FloodBoard as a training companion. Learn to see the board the way an AI would try to solve it.
The idea
Instead of thinking about the puzzle as a grid of tiles, FloodBoard looks at it differently:
-
Each contiguous block of same-colored tiles becomes a region
-
Each region becomes a node
-
Adjacencies between regions become edges
Mathematically, the board stops being a picture grid and becomes a graph. (This doesn’t change the way the game is played, but it allows FloodBoard to make more useful calculations for solving it.)
And if you can start looking at it that way yourself, the entire puzzle changes.
What changes when you see regions instead of tiles
When you pick a color in FloodBoard, you shouldn’t be thinking “How many squares will I grab?” You should be asking:
-
How many regions will I grab?
-
How many new regions will become reachable after this move?
-
How much future territory does this open up?
-
Will this color be eliminated from the board entirely?
These are the kinds of signals an algorithm uses to judge move quality.
And if you turn on analysis mode, FloodBoard will display these metrics for every possible move.
The idea is not to rely on the display forever. The goal is to learn to predict what it will say before you turn it on.
After a while, something interesting happens. You stop seeing colors. You start seeing frontiers.
You begin to notice that one move only pulls in a small region, but it exposes a huge boundary to another color. You start to anticipate the game state strategically.
Why this is not a solver
An actual solver would take these signals, combine them into a scoring function, and search for the optimal sequence of moves.
FloodBoard stops just before that step, showing you the signals, but leaving you to decide what to do about them.
This is how you to train yourself to master the board.
Command line, by design
FloodBoard runs in a terminal. No fancy graphics, no mouse, no animations. Just a colored board and numbers you type on the keyboard.
That is intentional. Not just to make a fun pasttime playable in the console - but to let you play with the ideas too.
It’s written in Python.
Which means you can mess with the code and add your own algorithms to the pot.
Sound like fun? You’ll find it here.