# Enigmatic Code

Programming Enigma Puzzles

## Puzzle #02: Getting past the freight train

From New Scientist #3229, 11th May 2019 [link] [link]

A very long passenger train is heading along a single track railway behind a freight train composed of a locomotive and three freight trucks. They are approaching a station where the freight train is due to unload. To keep to its timetable, the passenger train needs to leave before the freight train will have had time to unload.

At the station, there is a siding that either train could drive into. The siding is large enough to hold a locomotive and one freight truck, or two freight trucks. Both trains have couplings at the front that allow them to push and pull trucks. How can the passenger train get past the freight train so that both can continue on their journey?

[puzzle#02]

### 3 responses to “Puzzle #02: Getting past the freight train”

1. Jim Randell 10 May 2019 at 8:57 am

This seems fairly straightforward:

Suppose the freight train is at the front with trucks A, B, C, followed by the passenger train.

The passenger train approaches the freight train and couples trucks B and C to its front. The freight train with truck A goes into the siding. The passenger train continues past the siding, and the freight train with truck A emerges from the siding behind the passenger train. The two trains then reverse down the track until they are ready to use the siding again.

The passenger train, which still has trucks B and C attached to the front, shunts the freight trucks into the siding, and then continues on its way. The freight train collects trucks B and C from the siding and continues to the station to unload.

If this is the kind of puzzle New Scientist are going to continue with I am not sure I will bother with them.

2. Julian Gray 10 May 2019 at 3:25 pm

Agreed. It’s marginally more interesting if the freight train has to be re-assembled in its original order with the three trucks A, B and C behind the engine.

• Jim Randell 10 May 2019 at 3:39 pm

Yes. I did think about that too, but decided the thrust of the puzzle was that the passenger train should get on its way as soon as possible.

I was thinking about a similar problem recently. Involving the best way for two groups of vehicles, travelling in opposite directions along a single track road (there are lots of narrow roads where I live) to use a passing place that will only hold one vehicle in order to continue their journeys.

But if you are hungry for more Enigma style puzzles I have recently started posting my comments and solutions to puzzles from The Sunday Times at S2T2.

This site uses Akismet to reduce spam. Learn how your comment data is processed.