How a puzzle about moving colored balls between tubes descends from a 19th-century
toy, a 1970s card game and the logistics of shipping container yards β and why mathematicians
only caught up with it in 2022.
The rules fit in a sentence. You have a row of tubes holding colored balls stacked on top of
one another. You may lift the topmost ball from any tube and drop it onto an empty tube, or onto a
ball of the same color. Sort every color into its own tube and you win.
That is the whole game, and it is almost certainly the most-installed puzzle mechanic of the
2020s. It is also much older than the app that made it famous.
1883 – The ancestor: the Tower of Hanoi
The French mathematician Γdouard Lucas sold the Tower of Hanoi as a toy in 1883, under the
pseudonym "N. Claus de Siam" β an anagram of "Lucas d'Amiens". Discs of decreasing size sit on one
of three pegs; move them all to another peg, one at a time, never placing a larger disc on a
smaller one.
The family resemblance is obvious: a small number of stacks, a legality rule about what may sit
on what, and a goal state that requires temporarily making things worse. The difference is what
makes ball sort interesting. Hanoi's constraint is a strict ordering β every disc is unique and
there is exactly one legal arrangement. Ball sort has interchangeable pieces: four balls of
the same color are identical, so the puzzle has an enormous number of equally valid solutions and
no obvious recursive structure to exploit. Hanoi has a clean formula for the minimum number of
moves. Ball sort, as we will see, has nothing of the kind.
1978 – The card-game branch: FreeCell
The other half of the lineage runs through patience games. Paul Alfille wrote FreeCell in
1978 for the PLATO educational computer system at the University of Illinois, adapting an older game called Baker's
Game. Its innovation was the four "free cells": open slots that hold one card each, used purely as temporary parking
while you rearrange the columns.
Anyone who has played ball sort will recognise that immediately. The empty tube is a
free cell. The core tension in both games is identical β you have a small, precious amount of
scratch space, and the skill lies in planning a sequence of moves that unwinds a tangle without
running out of it. Spider Solitaire contributes the other half: building descending runs of
matching suit, where placing a card onto a compatible card is the legal move, much as a ball may
only land on its own color.
FreeCell reached a mass audience when Microsoft bundled it with Win32s in 1992 and then with
Windows 95, where it became the game that taught a generation the pleasure of a puzzle with no
hidden information and no clock.
1990s – The industrial cousin: container yards
While the mechanic was drifting toward toys, operations researchers were studying it in deadly
earnest. In a shipping container terminal, containers are stacked in towers. When a truck arrives
for a container buried three deep, the ones above it must be moved somewhere β onto other stacks,
because there is nowhere else. Choosing where to put them, so as to minimise the total number of
wasteful relocations, is known as the container relocation problem or
blocks relocation problem.
It is the same puzzle. Stacks with limited height, a last-in-first-out constraint, a shortage of
free space, and a cost paid for every move you make only to undo a previous one. The literature is
substantial and still active, with recent work throwing reinforcement learning and branch-and-bound
at instances that remain computationally nasty. A crane operator in Rotterdam and a commuter
tapping at a phone are, formally, doing the same work.
2020 – The mobile boom
The version most people have played arrived in 2020, when the Australian studio IEC Global Pty
Ltd published both Ball Sort Puzzle and Water Sort Puzzle. The two are nearly the
same game with different skins β balls stack discretely; water pours, merges and flows in
quantities β and both spread with remarkable speed through the first year of the pandemic.
The mechanic suited the moment and the business model almost perfectly:
- It costs nothing to draw. A tube is a rounded rectangle; a ball is a circle
with a highlight. No artists, no animation budget.
- Levels generate themselves. Shuffle the balls, check solvability, ship it.
There is no hand-authored content to run out of.
- No timer, no dexterity. It can be played one-handed, badly, half-attentively,
and picked up again mid-level hours later.
- It monetises without friction. Getting stuck is intrinsic to the design, and
the obvious rescues β an undo, one extra tube β are exactly the kind of small mercy players will
watch a rewarded video for.
What followed was one of the most conspicuous cloning waves the app stores have seen. Search
either store today and you will find hundreds of near-identical titles, many sharing template code
and differing only in name and icon. The genre's pre-2020 web and Flash history is genuinely murky
for this reason β the mechanic is simple enough that it was probably independently reinvented many
times before anyone thought to build a business on it.
By the industry's own accounting, the early sort-puzzle category was a modest affair β bare
template UI, under about $2M a year, almost entirely ad-funded. The mechanic was enormously
popular and barely monetised.
2022 – The mathematics catches up
Two years after the boom, a group of Japanese algorithms researchers β Takehiro Ito, Jun
Kawahara, Shin-ichi Minato, Yota Otachi, Toshiki Saitoh, Akira Suzuki, Ryuhei Uehara, Takeaki Uno,
Katsuhisa Yamanaka and Ryo Yoshinaka β presented Sorting Balls and Water: Equivalence and
Computational Complexity at the 11th International Conference on Fun with Algorithms.
They proved three things worth knowing if you are building one of these games:
- Balls and water are equivalent. Despite the mechanical difference, the two
puzzles have the same solvability properties. The distinction is cosmetic.
- Both are NP-complete. Every solvable instance has a solution of polynomial
length β which places the problem in NP β but deciding solvability in general is NP-complete.
There is no efficient general algorithm, and short of a major upset in complexity theory, there
never will be.
- Empty tubes have a threshold. They established non-trivial upper and lower
bounds on how many empty bins are needed to guarantee that every instance is solvable,
in terms of the number of filled bins and their capacity.
That first result has a practical edge. Any developer who has tried to compute the true minimum
number of moves for a hard level and watched a breadth-first search grind through hundreds of
thousands of states has met NP-completeness in person. The honest engineering answer is to stop
looking for the optimum and use a fast heuristic estimate instead.
A year later Suthee Ruangwises added a pleasing curiosity: a physical zero-knowledge proof
for the ball sort puzzle, presented at Computability in Europe 2023. Using only a deck of cards,
you can convince someone that you know a solution to a given level without revealing a single move
of it β reportedly the first such protocol for an interactive puzzle involving moving objects.
2022-2026 – The genre grows up
Having been left as a cheap ad-funded curiosity for years, sort puzzles were rebuilt into a
serious commercial category by a series of games that kept the sorting fantasy and threw out the
vertical tube.
Block Jam 3D launched in spring 2022 and scaled through 2023, replacing the
one-dimensional stack with a 2D board and a limited dock, so that the scratch-space tension moved
from "which tube" to "which slot". Hexa Sort, released in 2023, dominated 2024 with
hexagonal geometry β more neighbours per tile, so more interconnection β plus automatic sorting and
spawning pieces that made a previously static puzzle feel alive. Then in 2025 Grand Games'
Magic Sort demonstrated that a polished water-sort game could earn on in-app purchases
alone, reportedly taking more than $40M in its first year and calling the whole ad-driven model
into question.
The through-line is that every successful variant loosened one constraint of the original β the
dimensionality, the tidiness of the board, the staticness of the pieces β while keeping the
moment that makes the genre work.
Why it works
Strip away the business history and a ball sort puzzle is an unusually pure piece of game
design.
It has perfect information: nothing is hidden, so every loss is your own fault
and every win is earned. It has no time pressure, which makes it legible to players
who bounce off anything demanding reflexes. Its state is completely visible at a glance
β you can read the entire board in a second, which is why it survives being played in thirty-second
bursts. And it has a genuine decision with teeth: the last empty tube is a resource
you can spend exactly once before the position closes up on you.
Then there is the completion. A tube filling to a single solid color is a small, unambiguous,
physically satisfying event, and a good implementation leans on it hard. That feeling is the entire
reason the genre outlived its clones β and it is a straight inheritance from the moment, forty-odd
years earlier, when a column of cards in FreeCell finally came clean.