Lux-AI-Challenge / Lux-Design-S1

Home to the design and engine of the @Lux-AI-Challenge Season 1, hosted on @kaggle
https://lux-ai.org/
Apache License 2.0
897 stars 152 forks source link

Position.direction_to() should return all directions which are shortest path #98

Open Gerenuk opened 2 years ago

Gerenuk commented 2 years ago

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"}

StoneT2000 commented 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

Gerenuk commented 2 years ago

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.