SORTING SEARCH · BFS VERIFIED

Water Sort Solver & Strategy Guide: Empty-Tube Math, Deadlocks & Optimal Pours

INTERACTIVE BFS SOLVER · 0 LOGIN

Water Sort Step-by-Step BFS Solver

Play Water Sort ↗

Load a preset or click colors to copy your own Water Sort bottles, then compute a verified shortest pour sequence in your browser.

Active color:

Loaded 4-Color Classic Trap. Click a bottle to edit layers, or press Solve.

Numbered four-layer color bottles arranged for Water Sort pours with two empty buffer tubes

Winning hard Water Sort boards comes down to one core invariant: protect your empty buffer bottles while excavating the deepest buried colors first. Although a four-layer tube puzzle looks simple, computer scientists Takehiro Ito, Jun Kawahara, Shin-ichi Minato, Yota Otachi, Toshiki Saitoh, Akira Suzuki, Ryuhei Uehara, Takeaki Uno, Katsuhisa Yamanaka, and Ryo Yoshinaka (2022, arXiv:2202.09495) proved two striking theorems about the game: Water Sort (pouring contiguous top runs) and Ball Sort (moving one unit at a time) are 100% equivalent in solvability, and deciding whether an arbitrary board is solvable is NP-complete.

Why Water Sort Solvers Use State-Space Search & Symmetry Pruning

Because Water Sort is NP-complete in general (and even supports physical card-based zero-knowledge proofs of solvability; see Suthee Ruangwises, 2023, arXiv:2302.07251), there is no one-line formula like Lights Out's matrix reduction. Instead, automated Water Sort solvers treat each board configuration as a node in a directed state graph and run Breadth-First Search (BFS) or heuristic A* search with three powerful pruning rules that humans can apply directly at the board:

  • Canonical Tube Order (Bottle Symmetry): Swapping which physical slot holds an empty bottle or a finished color does not create a new position. Solvers sort bottle states canonically to collapse duplicate branches by orders of magnitude.
  • Zero-Gain Pure-Stack Ban: Never pour a bottle that already holds only one color (like [3, 3]) into an empty bottle. That move uncovers zero buried colors and creates no new consolidation target.
  • Single-Empty-Target Pruning: When two empty tubes exist, pouring into the first empty tube is mathematically identical to pouring into the second—never branch on empty-slot choice.

Exact 5-Pour Deadlock Proof: How Burning Both Empty Tubes Kills a Solvable Board

Every level on Water Sort Online gives you k colors and k + 2 four-unit bottles (2 empty buffers) and is verified solvable before publication. Yet filling both empty bottles prematurely can lock a solvable puzzle into a true zero-legal-move dead end within five moves! Here is an exact counterexample verified directly on our live engine for Level 6 (Color Garden, 5 colors, 7 bottles, bottom-to-top arrays):

Start state: B1=[4,5,2,3], B2=[1,1,1,3], B3=[5,2,3,4], B4=[4,5,4,2], B5=[5,3,1,2], B6=[], B7=[].

  1. Pour B1 → B6 (moves Color 3 into empty B6).
  2. Pour B2 → B6 (stacks second 3 on B6; B2 now exposes [1,1,1]).
  3. Pour B3 → B7 (spends the second empty buffer on Color 4!).
  4. Pour B3 → B6 (adds third 3 to B6 = [3,3,3]).
  5. Pour B3 → B1 (pours Color 2 onto B1 = [4,5,2,2], filling B1 to capacity 4).

Inspect the resulting 7-bottle board: B1=[4,5,2,2] (full), B2=[1,1,1] (top 1), B3=[5] (top 5), B4=[4,5,4,2] (full), B5=[5,3,1,2] (full), B6=[3,3,3] (top 3), B7=[4] (top 4). Every bottle with open capacity shows a different top color (1, 5, 3, 4), while all three tubes topped with Color 2 are 100% full (length 4). Legal moves remaining: 0! That single greedy step #3 (pouring 4 into the last empty buffer before freeing a tube) caused an immediate crash—even though the exact same starting board solves cleanly in 15 pours.

Four Human Solver Rules That Mirror Optimal BFS Play

Watch what our exact BFS solver does across all 12 Puzzle Fern boards—it follows four clean tactical habits you can copy without a computer:

  1. Build One Complete Color Before Touching Your Second Empty Tube: Treat Empty Bottle #1 as your active collector for a color that already has 2–3 exposed top units (or a 3-unit bottom base like B2=[1,1,1,3] in Color Garden). Keep Empty Bottle #2 untouched unless spending it immediately empties another bottle within 1–2 pours.
  2. Free a Mixed Bottle to Manufacture a Fresh Empty Tube: A bottle containing four distinct singles (like B1=[3,1,3,1] in Three Streams) is actually an asset: clearing its top layers flips it into a brand-new empty buffer!
  3. Count Top-Layer Visibility Before Pouring Into Empty Space: Never park a lone color into an empty tube unless doing so uncovers a color you can immediately combine onto an existing matching top or finish a 4-unit tube.
  4. Avoid Splitting Contiguous Runs Across Half-Full Tubes: Because Water Sort pours as much of the top continuous color as fits, pouring a 2-unit run into a tube with only 1 empty slot splits that color back into two fragments—raising the board's transition entropy instead of lowering it.

Worked BFS-Optimal Walkthroughs (Three Streams & Four Corners)

Here are two complete, engine-verified shortest solutions (bottles numbered B1–B6 left to right, layers read bottom to top):

  • Three Streams (3 colors, 5 bottles — exact BFS optimum: 10 pours): Start B1=[3,1,3,1], B2=[3,1,2,2], B3=[1,3,2,2], B4=[], B5=[]. Rather than dumping the 2-unit 2s into empty space first, drain B1 completely into B4 and B5 so B1 becomes the dedicated home for Color 2: 1. B1→B4 (1) · 2. B1→B5 (3) · 3. B1→B4 (1) · 4. B1→B5 (3) (now B1 is completely empty!) · 5. B2→B1 (2×2) · 6. B2→B4 (1) · 7. B2→B5 (3) · 8. B3→B1 (2×2 — Color 2 complete!) · 9. B3→B5 (3 — Color 3 complete!) · 10. B3→B4 (1 — Color 1 complete!).
  • Four Corners (4 colors, 6 bottles — exact BFS optimum: 13 pours): Start B1=[3,2,1,3], B2=[4,2,4,1], B3=[3,3,4,1], B4=[2,1,4,2], B5=[], B6=[]. Dedicate B5 to Color 3 and B6 to Color 1, collecting three 1s immediately: 1. B1→B5 (3) · 2. B1→B6 (1) · 3. B2→B6 (1) · 4. B3→B6 (1) · 5. B2→B3 (4) · 6. B2→B1 (2) · 7. B3→B2 (4×2) · 8. B3→B5 (3×2) · 9. B4→B1 (2) · 10. B4→B2 (4 — Color 4 complete!) · 11. B4→B6 (1 — Color 1 complete!) · 12. B1→B4 (2×3 — Color 2 complete!) · 13. B1→B5 (3 — Color 3 complete!).

Exact BFS-Optimal Pour Benchmarks Across All 12 Puzzle Fern Levels

Every level below was solved to proven minimum pours using exact canonical Breadth-First Search directly against Puzzle Fern's water-sort/engine.mjs rules (and replayed move by move through pour() and isComplete()). Use these benchmarks as par targets when replaying on Water Sort Online:

Level Name Colors / Bottles Empty Buffers Verified Shortest Pours (BFS Optimal) Canonical States Explored
First Pour2 colors / 4 bottles23 pours6
Three Streams3 colors / 5 bottles210 pours36
Pebble Pool3 colors / 5 bottles211 pours62
Riverside4 colors / 6 bottles212 pours161
Four Corners4 colors / 6 bottles213 pours218
Color Garden5 colors / 7 bottles215 pours375
Quiet Fountain5 colors / 7 bottles215 pours318
Stepping Water5 colors / 7 bottles216 pours85
Six Springs6 colors / 8 bottles218 pours517
Blue Lagoon6 colors / 8 bottles219 pours479
Garden Estuary7 colors / 9 bottles221 pours1,429
Rainbow Brook7 colors / 9 bottles223 pours1,076

Notice how smoothly the par pour count scales with color count—roughly 3.0 to 3.3 pours per color on well-mixed k + 2 layouts—and why the hardest 7-color boards still yield cleanly once you protect your empty swap tube. Try beating par on Water Sort Online (complete with 200-step Undo and numeric color labels), or test reversible planning on Sokoban Online.

Frequently Asked Questions

Is Water Sort Puzzle mathematically hard for computers too?

Yes. Ito et al. (2022, arXiv:2202.09495) proved that Water Sort and Ball Sort have identical solvability and that deciding whether an arbitrary configuration can be solved is NP-complete, even though bounded 2-to-7-color levels solve rapidly with breadth-first search (BFS).

Why do most Water Sort boards give you two empty bottles?

Two empty bottles act as a working swap buffer. Filling both empty bottles with partial stacks of different colors collapses your workspace to zero, which can trigger a 0-legal-move deadlock in as few as five pours.

Should you ever pour a single-color stack into an empty bottle?

No. Moving a pure stack (such as [2, 2] with nothing underneath) into an empty bottle changes zero color boundaries and wastes a pour without uncovering any buried layer.

What is the shortest pour count for Puzzle Fern Water Sort levels?

Exact breadth-first search across Puzzle Fern's 12 original levels proves minimum pour counts ranging from 3 pours on First Pour (2 colors, 4 bottles) up to 21 pours on Garden Estuary and 23 pours on Rainbow Brook (7 colors, 9 bottles).

Sources & Primary References

Ready to test these deductions on a live board?

Play in your browser with multi-step Undo, zero timers, and automatic local progress saving.

Play Water Sort Online

Top Daily & Breakout Picks

Today’s 6-Game Daily Hub →