# Duplo train tracks

This weekend I was helping my three year old build some train tracks for his Duplo train. The train is powered by a small battery, so it moves on its own. His collection of pieces includes a bunch of straights and turns, and two switches. This is what we built:

The train can approach a switch from three possible directions:

When the train comes from direction 1, it will follow the path that is opened by the red lever on the switch. When the train comes from one of the other two directions, there is only one way to go. If the switch is in the way, it will be pushed aside by the train (direction 3 in the example).

I want to build a track where the train continuously loops across the entire track system, moving switches as needed. I want to know the minimum number of pieces required to achieve this. Some restrictions:

• The solution has to work for each starting point and each traveling direction.
• The solution has to include more than two switches.
• No human interaction is allowed other than initial placement and activation of the train.

All I managed to find is a solution with two switches and 24 curves, similar to the one that @JonTheMon used for his answer. I want to know if there's a solution when using more than two switches.

It looks like, as JonTheMon suggested in the comments of his answer, there is no solution to this problem that involves more than 2 switches.

I will use the following terminology when discussing switches:

• Base: The "single" side of the switch, like the base of the "Y" shape
• Arm: Either of the "forked" ends of the switch, like one of the upper portions of the "Y" shape

1. If you enter any switch from an arm, then upon return through that switch from the other direction (from the base), you will necessarily follow the same arm.

2. If you enter any switch from the base, you will exit on a given arm, and will necessarily return on the same arm unless you have made a loop that connects to the other arm. This is the only way that a switch's position can be continually changed (by exiting on one arm and then returning on the other arm). (It is possible to change a switch's position by entering on one arm, then looping around and entering on the other arm, but if this happens, the first arm will be forever inaccessible after that point, and the switch will no longer change.)

3. For a train to be able continuously travel the entire track, every switch must be regularly switched back and forth between its two states (if it stops switching, there is a part of the track that becomes inaccessible).

4. By (2) and (3), the only way to have a train continuously travel the entire track is to have only switches (A) whose arms are directly connected by a loop of track (a). If the arms aren't directly connected (i.e. there is another switch (B) between them somewhere) then you will be entering switch B from an arm at some point (since you are travelling loop a in both directions, and at least one direction must be connected to an arm of switch B). By (1), you will have to return on that same arm, and thus there will be a part of the track that is never accessed. The only way switch B will allow things to work is if its arms are also directly connected by a loop of track (b). But we already know that at least one of its arms is connected to one of the arms of switch A, so its arms can't be directly connected to each other.

By (4), our track can only consist of switches whose arms are directly connected to each other, and thus the solution presented by JonTheMon is the solution employing the most possible switches (2 of them).

There are many solutions if you link points so that they switch together. Here are 4 switches, linked as two pairs with simple wire arches.

This 'auto switching layout' requires the train to traverse 10 stretches of track to reset the whole layout, so some tracks are used more than once. More designs (which can be run in your browser) at: http://www.cr31.co.uk/stagecast/trains/tt8_auto_run.html

Alternatively, if you obtain the old type of 'sprung' Duplo points you can build various binary counters or flip flop gates like this one which uses one sprung and a pair of linked lazy points.

These kind of layouts use many pieces though, so I won't list them. More Duplo layouts at: http://www.cr31.co.uk/stagecast/trains/tw1_duplo.html

Create a barbell type track. The train will go to one end, use the switch to enter a loop, then come back to the middle, go to the next end, enter the other switch, then come back to the middle. Repeat.

So, 2 switches, 1 straight for mid, and it looks like 13 per loop (3 straight, 10 curved) = 2 switches, 7 straight, 20 curved

• I was expecting this one, but hoping there is a shorter solution. And I mean shorter than just removing the straight in the middle ;) Feb 23, 2015 at 16:30
• Actually, I think this is the only solution to going over all tracks and only using the train's movement through a switch to change the switch. You can start getting more complex tracks if you have switches that affect other switches. Feb 23, 2015 at 17:05
• Then perhaps I shoud reevaluate the question. Do you suppose it would be a more interesting problem if there had to be more than two switches? Feb 23, 2015 at 18:14
• That might be a good addition, mentioning that you can only get a 2-switch system, and ask if it's possible to get a 3-switch system. Feb 23, 2015 at 19:00
• I think an 8 figure track would be shorter as the switches act as 4 curves (so like 16 curves, 2 switches) Apr 10, 2015 at 18:57