Open Gerenuk opened 2 years ago
per discussion on discord. Not sure if this will be added as I also think this is a matter of preference. Leaving this issue open so that other competitors can see and also consider using since it is helpful depending on how your navigation algo works
Or the new function could be called directions_to(...)
Then one can leave the old function. Even though I cannot imagine that someone would not care about knowing all directions. If the arbitrary direction is blocked, it would be a hassle trying to figure out the remaining optimal direction. Unless you are fine with workers standing still due to being blocked and not going the equally shortest path.
Currently,
Position.direction_to(target_pos: Position) -> DIRECTIONS
will return only a single direction. However, most of the time there are two possible directions for the shortest path. For implementing a move optimizer it is important to know all possible shortest path directions as there are usually 2 (unless some coordinate is identical).Therefore, I suggest to implement the function as
Position.direction_to(target_pos: Position) -> Set[DIRECTION]
which returns a set of all directions in order to most quickly reach the destination.For example
Position(1,1).direction_to(Position(2,2)) -> {"s", "e"}