YayPlays

How to play

Shunt Yard: Choose a level
1Choose a level
Shunt Yard: In play
2In play

Controls

Tap
  1. Wagons wait on the ARRIVALS track; only the wagon nearest the junction can move. Tap a track to pick up its end wagon, then tap where it should go: a siding or the DEPARTURES track.
  2. Sidings are dead ends: wagons go in and come out at the same end, so the last wagon pushed in is the first one out, and each siding only holds the number of wagons shown. The departure train must be built in order: wagon 1 first, then 2, then 3 and so on, so a wagon can only go to DEPARTURES when it is the next number.
  3. Wagons can also move from one siding to another. UNDO takes back a move (it still counts), RESET starts the yard again.
  4. The fewest moves possible is shown; match it for three stars, stay within four extra moves for two.

Shunt Yard: all 18 yards in the best move count, 272 moves in all

Every yard was finished on the first try in exactly the best number of moves the game shows, so all 18 earned three stars: 272 moves in all, from 5 in yard 1 to 26 in yard 18. Each plan came from our own breadth-first search over the yard; the game's solver was never used, and its best count was only compared at the end. Each move is two taps, the track whose end wagon goes and where it goes, and the script tapped faster than a person plans a yard.

Build the train 1, 2, 3...

  • Wagons arrive on the top track in a jumbled order. The engine moves one end wagon at a time into a dead-end siding or onto the departure track.
  • The departing train must be built in order: wagon 1 first, then 2, then 3. Sidings hold only as many wagons as the number on their sign, and the last wagon in is the first out.
  • Tap a track to pick its end wagon, then tap where it goes. UNDO also counts as a move.
  • Match the best move count on the sign for three stars, go up to four over for two.
Yard 1 after three moves: Moves 3 · best 5, wagon 1 already on DEPARTURES.
Yard 1 after three moves: Moves 3 · best 5, wagon 1 already on DEPARTURES.

How the yards were planned

For each yard the script took the tracks as the game holds them and tried every legal move of an end wagon, from the arrivals or a siding into another siding or onto departures, with the game's own move rule (siding size, departure order). It kept the first sequence that sent every wagon out, which is also a shortest one, and tapped it in.

The searches grew quickly with the third siding: yard 16, nine wagons and three sidings of three, needed 292,308 yard states, while yard 17, nine wagons and two sidings, needed only 2,872.

YardsWagonsSidings (sizes)Moves = bestYard states searched
1-33-41 or 2 (2, 2/2, 3)5, 8, 76-54
4-65-62 (2/2, 3/2, 3/2)12, 11, 1458-158
7-96-72-313, 14, 19598-1,484
10-127-82-314, 16, 172,317-43,820
13-158-92-321, 16, 182,278-248,478
16-1892-3 (3/3/3, 4/3, 4/4)19, 22, 262,872-292,308
Yard 6 after 8 of 14 moves: Siding 1 (3) full, Siding 2 (2) holding two.
Yard 6 after 8 of 14 moves: Siding 1 (3) full, Siding 2 (2) holding two.

Three sidings

From yard 7 some yards have three sidings. More room makes a yard shorter but harder to search: yard 14 (three sidings of three) took 16 moves and 153,776 states, yard 13 (two sidings) 21 moves and 2,278 states. The longest yard is the last one, 18: nine wagons, two sidings of four, 26 moves.

Yard 12 after 9 of 17 moves: three sidings of 3, 3 and 2, all in use.
Yard 12 after 9 of 17 moves: three sidings of 3, 3 and 2, all in use.

Shunting by hand

Before moving anything, find the next wagon the departure track needs and count what is stacked on top of it. Park those wagons so that the smaller numbers end up nearer the siding's exit, since they leave first. Keep one siding as empty as you can for juggling. A wagon that can go straight to departures should go there at once: every extra stop costs a move, and so does UNDO.

Yard 18: TRAIN READY! in 26 moves, best 26, three stars.
Yard 18: TRAIN READY! in 26 moves, best 26, three stars.

Questions

Does UNDO cost anything?
It counts as a move, so it can cost a star.
What does best mean in the sign?
The smallest number of moves for that yard; match it for three stars.
How far did our run get?
All 18 yards, each in the best move count at the first try.

· Corrections log

Suggest an idea or report a problem

We keep only your message (and email, if given) to improve the games.