Module

Data.Pathfinding.AStar

Package
purescript-astar
Repository
lfarroco/purescript-astar

#runAStarNonDiagonal Source

runAStarNonDiagonal :: AStar

If diagonal cells shouldn't be used during search

#runAStarDiagonal Source

runAStarDiagonal :: AStar

If diagonal cells should be used during search

#AStar Source

type AStar = forall a. Ord a => Array a -> Vector2d -> Vector2d -> Array (Array a) -> Array Vector2d

Parameters to run the pathfinder:

  • Array of blocked cell types (eg. [1] or a custom Ord type [Wall])

  • Source cell Vector2d (eg. {x: 0, y: 0})

  • Goal cell Vector2d (eg. {x: 1, y:2})

  • Two-dimensional Array of cells (eg. [[0,0,0], [0,1,0]])

The result will be an Array of Vector2d including the source and target cells.

#Vector2d Source

type Vector2d = { x :: Int, y :: Int }

An alias for a 2d coordinate

#vector2d Source

vector2d :: Int -> Int -> Vector2d

Creates a Vector2d