Cauldron2D.Grid.Coarse.Search (Cauldron2D v0.2.2)

Copy Markdown View Source

A* over a graph given as functions, as Cauldron2D.Grid.Coarse searches its regions and its tiles.

Search.run(start, &(&1 == goal), fn node -> [{next, cost}] end, fn node -> estimate end)

arrived? says a node ends the search, steps gives each node's neighbours with the cost of stepping to them (positive), and estimate the least cost still to go from a node, never more than the true cost. The result is the cheapest way as its nodes, the start first and the node arrived at last, or :none when no node reachable arrives.

Summary

Functions

The cheapest way from start to a node arrived? accepts; see the module documentation.

Types

step()

@type step() :: {term(), number()}

Functions

run(start, arrived?, steps, estimate)

@spec run(term(), (term() -> boolean()), (term() -> [step()]), (term() -> number())) ::
  {:ok, [term()]} | :none

The cheapest way from start to a node arrived? accepts; see the module documentation.