allShortestPaths

Get the shortest path between a coordinate and each coordinate within a limited range.

allShortestPaths
(
alias cost
T
U : real
)
if (
is(typeof(cost(grid.tileAt(RowCol.init))) : U)
)

Parameters

cost

function that returns the cost to move onto a tile. To represent an 'impassable' tile, cost should return a large value. Do NOT let cost return a value large enough to overflow when added to another. For example, if cost returns an int, the return value should be less than int.max / 2.

T

type of the grid

grid T

grid of tiles to find path on

start RowCol

tile to start pathfinding from

maxCost U

limit pathfinding to tiles within this cost of the center (inclusive)

Return Value

Type: auto

A structure that contains the cost and path to each tile within range.

Meta