flatland.core.grid.grid4_utils module

flatland.core.grid.grid4_utils.direction_to_point(pos1:Tuple[int, int], pos2:Tuple[int, int]) → flatland.core.grid.grid4.Grid4TransitionsEnum[source]

Returns the closest direction orientation of position 2 relative to position 1 :param pos1: position we are interested in :param pos2: position we want to know it is facing :return: direction NESW as int N:0 E:1 S:2 W:3

flatland.core.grid.grid4_utils.get_direction(pos1:Tuple[int, int], pos2:Tuple[int, int]) → flatland.core.grid.grid4.Grid4TransitionsEnum[source]

Assumes pos1 and pos2 are adjacent location on grid. Returns direction (int) that can be used with transitions.

flatland.core.grid.grid4_utils.get_new_position(position, movement)[source]

Utility function that converts a compass movement over a 2D grid to new positions (r, c).

flatland.core.grid.grid4_utils.mirror(dir)[source]