Ideally, a unique algorithm for districting would be written into the constitution. It would no doubt sometimes produce silly results, but it would have to be pretty bad to produce sillier ones than are now perpetrated by legislatures & federal judges.
A compromise that would leave some room for undignified wrangling but might remove most of the temptation and the resulting damage would be the following: A district shall be bounded by at most four contiguous segments each of which shall be one of the following: a state boundary, a parallel of latitude, a meridian of longitude.