gekro
GitHub LinkedIn

Colour Tubes

Play a free colour-sorting puzzle: pour layers between glass tubes until each tube holds one colour. Three to eight colours, undo, an extra tube and a hint.

Moves 0

Finished 0

Your best -

Colours in this game

    Tap a tube to pick it up, then tap another tube to pour the top colour into it. A pour works when the other tube is empty or shows the same colour on top, and has room. Tubes you can pour into get a dashed edge. Arrow keys move between tubes, Enter or Space picks up and pours, 1 to 9 choose a tube directly, Escape puts a tube down, U undoes, H gives a hint. The extra tube can be added once and helps if you get stuck. A best score only counts if you did not use the hint.

    How the levels and the hint work

    Each colour has exactly four layers, and every tube holds four. A level starts from the solved tubes and undoes random legal pours, one at a time, until the tubes are well mixed. Playing those pours forwards in reverse order always solves the level, so a level can never be impossible at the start.

    You can still get into a dead end by pouring badly. Undo takes a pour back, and the extra tube gives you one more empty place to work in. The hint runs a search from where you are now, with a limit on how long it looks. If it finds a way it points to the tube to pick up and the tube to pour into. If it proves there is no way out from here it says so, and if the limit runs out first it says it could not find one.

    As-is, no warranty. These apps are free under their listed license and run entirely in your browser. Use at your own risk — don't blame me if your PC catches fire, your dog runs away, or the math turns out wrong. Verify anything that actually matters. None of this is professional financial, medical, legal, or engineering advice.

    © 2026 Rohit Burani · MIT · Built at gekro.com · View source ↗

    Guide

    How to play

    Each glass tube holds up to four layers of colour. Tap a tube to pick it up, then tap another tube to pour the top colour into it. A pour works when the second tube is empty, or shows the same colour on top, and has room. If the top of the first tube is a run of several layers of one colour, the whole run moves as far as the room allows. Keep going until every tube is either empty or full of a single colour.

    Pick how many colours you want, from 3 to 8. A game has that many colours in the same number of tubes plus two empty ones, so the smallest game has 5 tubes and the biggest has 10. If you get stuck you can add one extra empty tube, once per game. Undo takes back the last pour, Restart returns to the starting tubes, and New game deals a fresh level. The page address holds the colour count and the level seed, so you can send someone the exact level.

    Tubes you can pour into get a dashed edge once you have picked one up. If you tap a tube that cannot receive the pour, that tube is picked up instead, so you can change your mind with one tap.

    Keyboard. The arrow keys, Home and End move between tubes. Enter or Space picks up a tube and then pours. The keys 1 to 9 choose a tube directly. Escape puts a tube down, U undoes and H gives a hint. These keys only work while the focus is on the tubes.

    Colour is never the only clue. Every colour has its own shape and its own background pattern. Blue is a circle on diagonal stripes, yellow a square on dots, red a triangle on checks, green a diamond on bars, purple a star on upright stripes, orange a plus on cross-hatching, teal a hexagon on rings and lime a pentagon on backward stripes. A key under the tubes shows all of them. Screen readers get a description of every tube, such as “from the bottom 2 blue, then 1 yellow, room for 1”, and a short sentence after every pour.

    A finished tube shows a tick and a green edge. The game never ends in failure. If no pour is left, the status line says so and suggests undo, the extra tube or a restart.

    How it works

    The generator runs the rules backwards. A level begins as the solved tubes. The generator then undoes one random legal pour at a time. Undoing a pour is only allowed when playing it forwards again would move exactly the layers that were taken, which gives three small conditions that the code checks. Played in reverse order, the undone pours solve the level, so a level is solvable by construction. The generator keeps scrambling until at least k - 1 tubes are mixed (k is the colour count), no tube is already finished and few neighbouring layers share a colour. It then makes 12 candidates and keeps the one that the search below needs the most pours for, as a cheap measure of how tangled it is.

    The hint is a search with a budget. From the current position the page runs a best-first search. A position is the sorted list of tubes, so two positions that differ only by tube order count as one. The search stops after 60,000 positions. It then does one of three things: it finds a list of pours and points at the first one, it has searched everything reachable and tells you there is no way out from here, or it runs out of budget and says it could not find a hint. The hint does not promise the shortest solution. Using the hint on a level means that level does not count toward your best.

    Your best is the fewest pours you used to solve a level with that many colours. Undo takes a pour away from the count. Using the extra tube is allowed and still counts.

    What the tests check

    • The pour rule matches a second model that moves one layer at a time, on every pair of tubes in 400 generated levels.
    • For every colour count from 3 to 8, 150 generated levels each have exactly four layers of every colour, are not solved at the start, have no finished tube and replay their stored solution to a solved position.
    • For 25 three-colour levels, an independent breadth-first search over tube positions agrees that the level is solvable, and finds a shortest solution no longer than the stored one.
    • On 60 random positions of three colours in four or five tubes, the hint search agrees with exhaustive search about whether a solution exists, and any solution it returns plays legally to a solved position. Some of those positions have no solution, and the search reports that correctly.
    • At every colour count the search finds a solution within its limit for at least 10 of 12 generated levels, and the average solution is longer at 6 colours than at 3, and longer again at 8.
    • A saved best is accepted only as a whole number from 1 to 9999 for a known colour count. Anything else is ignored.

    Limits

    • Eight colours is the most, because that is how many hues, shapes and patterns the page can tell apart.
    • The hint can run out of budget on a hard position. Then it says so instead of guessing.
    • The two-empty-tube start and the single extra tube are fixed rules, not options.

    Everything runs locally in your browser. There is no account, nothing is uploaded, and your best scores stay on your device.

    All Fun tools →

    For informational purposes only. Not financial, medical, or legal advice. You are solely responsible for how you use these tools.