puzzle-me

Shunt — Railway Shunting Puzzle with a Reversing Siding

Reverse the line, couple the colours, keep moving

LogicDifficulty: Medium4-10 minDesktop & mobile

🏆 Leaderboard

🏆 Leaderboard

Best scores from every player, worldwide.

Change name

Achievements

What is Shunt — Railway Shunting Puzzle with a Reversing Siding

Shunt is a marshalling yard on one screen. A locomotive stands at the head of a line of six wagons, each painted one of four colours and stamped with its own symbol, so the shapes stay readable even when the colours do not. Tap any wagon and the loco pushes everything from itself up to that wagon into the siding, then draws it straight back out. The siding is a dead end, so the section returns in reverse order. That is the whole move, and it is what bites: you are not swapping two wagons, you are turning a block around.

Three or more wagons of one colour standing together are dispatched to the depot, and the line re-couples across the gap, which can set off a further clearance. Every move that dispatches nothing couples one more wagon to the tail, drawn from a queue of three you can see in advance. The yard holds fourteen, and when a full line has nowhere to put the next wagon the run ends. Points come from the length of each block, from gold wagons inside it, from how deep the chain runs, and from a large bonus for emptying the line.

How to play

  1. Tap any wagon except the one coupled to the locomotive. Everything from the head up to that wagon goes into the siding and comes back out in reverse order.
  2. Three or more wagons of one colour side by side are dispatched. The wagons on either side of the gap couple up, and if that joint completes another block it clears too, as a chain.
  3. Each move that dispatches nothing brings one wagon from the incoming queue onto the tail. The yard holds fourteen, and the run ends when a full line has nowhere to put the next one.
  4. Uncouple, three times per run, lifts out one wagon of your choice and draws nothing back. It is the only way to shorten the line without a dispatch, and it can reach the head wagon.

Strategies that work

  • A reversal only ever creates one new coupling. After the flip the old head wagon sits where you tapped, meeting the wagon that used to follow your target; everything else keeps its neighbours, mirrored. So before you tap, check that single joint: front wagon against the wagon behind your target.
  • That makes the two wagons at the head your engine. If they share a colour, look down the line for any wagon whose follower carries that colour, and tap it: the pair swings round to meet it and three couple at once. If the head pair is mismatched, first bring a matching pair forward.
  • Length pays far more than frequency. On Line 1 with no gold, a block of three scores 60, four scores 120, five scores 200 and seven scores 420. Cashing in a ready-made three costs you the wagons that would have extended it, so while the line has room, line up the fourth first.
  • Gold wagons multiply the whole block, not just themselves: one gold doubles the points, two quadruple them, three or more multiply by eight and there it stops. A plain triple worth 60 becomes 480 with three golds inside. When gold enters the queue, build the block that will swallow it.
  • Chains come from the re-coupling after a dispatch, and each further clearance in the same move multiplies by its own depth: the second pays double, the third triple. Emptying the line pays 1 200 points plus 300 per Line reached, and only four wagons return. Keep one uncouple for the head wagon.

A little history

Shunt was written for this site, but the object underneath it is old and well studied. A siding is a stack: the last wagon in is the first one out, which is why a block pushed in comes back reversed. Computer science borrowed exactly that picture — Knuth used a railway siding to illustrate the stack and asked which orderings a siding can produce, a question answered by the Catalan numbers. Because the whole block goes in and comes straight back, each move here is a prefix reversal, the operation behind the pancake-sorting problem studied by Gates and Papadimitriou.

Frequently asked questions

Do I need to install anything?

No. Shunt runs in the browser as a single page, with nothing to download and no account to create. It works on a phone as well as a computer: on a narrow screen the line stands upright instead of lying across, so the wagons stay big enough to tap.

How is the score worked out?

Each dispatched block scores ten times its length times one less than its length, so three is worth 60 and five is worth 200. That is doubled for every gold wagon in it, up to eight times, then multiplied by the depth of the chain and by the Line reached.

Is the daily challenge the same yard for everybody?

Yes. The daily seed comes from the date in UTC, so every player starts from the same six wagons and draws the same wagons in the same order. Free run takes a fresh random seed each time, which is the mode for practice.

Our other sites

More to play and discover