Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Thanks for this, I've been obsessing about track layouts while playing trains with my kid, how to avoid getting stuck in permanent loops, having bi-drectional routes on all parts of the track etc. As I'm not a math person, I've not had a logical framework with which to think about it. my kid doesn't care but laying out tracks been a surprisingly fun mind game for me.


You may want to search for "shunting puzzles", such as those here: https://www.transum.org/Software/Shunting/Puzzles.asp

Every time my model train interest rises, I consider setting up a small layout for puzzles like these.


I've wanted to make timesaver for quite some time now.


Those look fun, thanks for the tip!


Ditto. The ideal track layout should allow trains to go in either direction across every segment. Bonus for going under a bridge. I also haven't really worked out the graph theory (something involving the +/- orientation of junction splits) but the temptation is immanent.


I also play trains with my kid, and I might be thinking about the same stuff. When I build a track, I think "given a position and direction, could I reach every other (position,direction) pair from here?". There's a certain minimum complexity required for a track to have that property, but I haven't really broken it down in a principled way.


I've been doing this too, with mine! A recent discovery is that if you keep all the Y pieces pointing in the same compass direction you seem to end up with a track which is always 100% traversable in either forward or reverse.


That can’t be true, can it?

Traversable doesn’t change if you bend parts of a track, and that can change the compass direction the switches point at.

For example, if part of the track containing a switch has an S shape, moving the switch from the center horizontal to the top or bottom one turns it by 180 degrees without affecting traversability.


I know nothing about train tracks past my BRIO days, but a bit about graphs. Can you explain how a track would not be bidirectional except for a permanent loop?


Bidirectional without backing up. To turn a train around, you need a closed loop at the end of the line or a triangle (wye).


One of the things that makes it more interesting in practice is that most electric model trains* use a "one rail is hot, one is return" electrical design-- so adding a wye or reversing loop to the design is asking for all sorts of electrical gimmicry to prevent it from shorting, while still maintaining usability.

*classic Lionel and Marklin designs used a third conductor in the centre. Since the outer rails are wired together, reversing designs are trivial.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: