March 12, 2026
4 min read

Can You Beat an Algorithm at Its Own Game?

AlgorithmsComputer ScienceLearning

An algorithm is just a precise list of steps. Every day you follow some without calling them that: a recipe, directions to a friend's house, the way you sort your cards before playing.

Some of our games are built directly on algorithms from computer science. You don't need to know that to play them. But once you do, you start to see why some moves work and others don't.

Pixel Flood: flood fill, and why greedy isn't enough

The paint-bucket tool in any drawing app uses flood fill. Start at one pixel, then spread to every touching pixel of the same colour, then to theirs, and so on. That's exactly what happens to your patch in Pixel Flood each time you pick a colour.

Pixel Flood's patch growing move by moveEach pick runs a flood fill from your patch. The wave you see is the fill spreading square by square.

The interesting part is choosing the colour. The obvious rule is: always pick the colour that adds the most squares right now. Computer scientists call that a greedy strategy. It's quick and often good, but not always best. Sometimes a small move now opens a huge area next turn.

Finding the truly shortest solution for boards like this is known to be very hard for computers too. Researchers have shown the general "Flood-It" problem is NP-hard, which roughly means no one knows a fast method that always finds the best answer. So when you beat your own greedy instinct by planning a move ahead, you're doing something that is hard in a real, mathematical sense.

Turtle Code: a program is a list of steps

Turtle Code is programming without typing. You line up blocks (MOVE, TURN L, TURN R) and press RUN. The turtle follows them exactly, one at a time, in order.

A three-step Turtle Code program runningLevel 1: three MOVE blocks, then RUN. The turtle does exactly what the program says, no more and no less.

That's the whole idea of a program. The computer doesn't guess what you meant. If the turtle walks into a wall, the program was wrong, and the fun is working out which step. The game shows a dotted preview of the path on early levels and marks where it went wrong. Its stars reward the shortest program, which is a first taste of making code efficient.

Rank It: you are the sorting algorithm

Rank It gives you five items and asks you to put them in order: cities by the size of their economy, say, or famous people by birth year. You swap rows until you're happy.

A Rank It puzzle: five items to sort from highest to lowestRank It: tap one row, then another, to swap them. You're doing by hand what a sorting algorithm does.

Sorting is one of the most studied problems in computer science. Most sorting algorithms boil down to the same move you're making: compare two things, swap them if they're the wrong way round, repeat. Rank It adds the hard part computers don't have: you don't know the exact values, so every comparison is a judgement.

Scale It: spreading the load

In Scale It you run a small set of servers and choose how incoming requests are shared out between them. Take turns (round robin), send each request to the least busy server (least connections), or pick at random. These are the same strategies real load balancers use to keep websites up. The game lets you see what happens when traffic spikes and one strategy falls behind.

Why play them this way?

You won't learn a whole computer-science course from a few puzzles. But these games give you a feel for ideas that are usually taught with dry diagrams: a greedy choice that fails, a program that does exactly what you said, a comparison that decides the order. That feel makes the textbook version much easier later.

Pick one and try it: Pixel Flood, Turtle Code, Rank It or Scale It.