darozak / Advolition

1 stars 0 forks source link

Allow robots to move in the direction of a distant object #18

Closed darozak closed 7 months ago

darozak commented 7 months ago

Right now robots specify a direction to move in by using a number between 0 and 7. However, a better way to specify movement would be by entering a vector direction. This direction will then be normalized to a unit vector and used to determine which of the eight adjacent squares the robot will move into.

The advantage of this technique is that the robot can specify a distant target and take a step in that direction.

darozak commented 7 months ago

Done. I created a vector method that identifies all tiles its path to a destination. The move function will then pick the first step n that path and move the robot to that location during it's turn (https://github.com/darozak/Advolition/commit/f8143ddf58f2303e1be48693ffe2f24cc392d2bb).