Alternative, one-loop method for calculating topo order

This one is longer and may get reverted soon
Simplify topological sort with one set of nested loops
Remove now useless parameters to topological order method
Handle signs correctly in topo order method

Since we've extended the "starting column" past the left of the grid, we
need to flip the sign when it goes below zero.
Watch both bottom and side edges when generating topo order