DijkstraPath

class DijkstraPath(target_tile: Tile, passable_callback: Callable[[Tile], bool])

Bases: PathFinder

Calculates a path using Dijkstra’s algorithm.

Parameters:
  • target_tile – The tile this pathfinder will try to reach.

  • passable_callback – Whether entities using this pathfinder can pass a tile.

compute(start: Tile) list[Tile] | None

Computes the path from the given tile to the set destination.

Parameters:

start – The tile to start from

Returns:

Either a list of tiles to get to the target, or None