3 ms·
It is surprisingly difficult to build train tracks given a set of parts, even without taking junctions into account - there is a challenge about it on Stack Ove
by mpettitt 7y ago
It is surprisingly difficult to build train tracks given a set of parts, even without taking junctions into account - there is a challenge about it on Stack Overflow's Programming Puzzle site (https://codegolf.stackexchange.com/q/116607/66060 https://codegolf.stackexchange.com/q/116607/66060) and there is only one answer in the two years it's been there. In some ways, real life engineers have it easier - they don't have to plan routes based on the parts in the box!
- TomK32 7y agoIt's so easy to monkey-patch a set of tracks, especially when you have different lengths of track, lots of them and a saw or router.
- Someone 7y agoHaving only one answer in two years doesn’t imply the problem is hard. I would think all ‘large enough’ puzzles of this kind are easy. You build a rectangle (needs four corners. If you don’t have those, no closed curve is possible), and use pairs of left-over curves to add detours to the straight ends, possibly compensating for an odd number of straight edges. I would guess there is an analog to Euler’s formula (https://en.wikipedia.org/wiki/Euler%27s_formula https://en.wikipedia.org/wiki/Euler%27s_formula) that describes what number of small corners, large corners, and straight ends can form a large closed curve. I also suspect ‘large enough’ isn’t that large, probably everything over 16 pieces or so (Smaller problems may be non-standard because they require effort to avoid overlap)