Because I lack algorithmic chops, were I to implement this, I would just generate the 2^n possibilities (n pieces, each piece turned left or right) and filter out the ones that don’t create a closed circuit. That’s doable, I think, for the maximum required N of 20 (~1e6 possibilities), but not for the extra credit Ns which range up to 48.
I’m sure there’s something in the literature on Euclidean paths, but in addition to lacking algorithmic chops, I’m lazy. -Dan > On Jan 24, 2016, at 9:45 PM, Raul Miller <[email protected]> wrote: > > http://rosettacode.org/wiki/Railway_circuit looks like an interesting > problem, but my knowledge of the geometry of that situation is poor enough > that I think any solution I attempt would be rather tedious. > > Does anyone feel up to an elegant solution (or is anyone willing to > implement a tedious solution)? > > Thanks, > > -- > Raul > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
