A map of towns, each at [x, y]. You may keep one straight road, and every town moves onto it, to its shadow (as in “The shadow”). Write main_direction(points): which way the road should run to keep the towns as spread out as possible, as an arrow [dx, dy] of length 1. Where the road sits doesn’t matter, only its direction, and either sign is fine: [1, 0] and [-1, 0] are the same road.
A county of 14 towns can afford one straight main road, and every town gets a side road built straight out to it. The less side road to build, the better the main road is placed. Build it where you like.
main_direction(points)| points | [x, y] for each town | e.g. [[0.5, 1], [2, 4], [3, 6], [1, 2], [4, 8]] |
| returns | the road's direction [dx, dy], length 1, that keeps | |