Henry Ernest Dudeney/Modern Puzzles/48 - Railway Shunting

by : $48$

 * Railway Shunting
 * How are the trains in our illustration to pass one another, and proceed with their engines in front?


 * [[File:Dudeney-Modern-Puzzles-48-question.png]]


 * The small side track is large enough to hold one engine or one carriage at a time, and no tricks, such as ropes and flying-switches, are allowed.


 * Every reversal -- that is, change of direction -- of an engine is counted as a move in the solution.


 * What is the smallest number of moves necessary?

Solution
Refer to the following diagram, in which:
 * the engines are $L$ and $R$
 * $L$'s carriages, never separated in the solution, are denoted by $X$
 * $R$'s carriages are $A$ and $B$
 * $S$ is the siding.


 * [[File:Dudeney-Modern-Puzzles-48-answer.png]]

Make the following moves: