Shawn M Moore > TAEB-0.03 > TAEB::World::Path

Download:
TAEB-0.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  1
View/Report Bugs
Source  

calculate_path [Tile,] Tile -> Path

Calculates the best path from Tile 1 to Tile 2. Returns the path object. If the path is incomplete, it probably leads to some unexplored area between the two tiles.

The path may not necessarily be the shortest one. It may relax the path a bit to avoid a dangerous trap, for example.

The "from" tile is optional. If elided, TAEB's current tile will be used.

first_match Code, ARGS -> Maybe Path

This will return a path to the first tile for which the coderef returns a true value.

max_match Code, ARGS -> Maybe Path

This will return a path to the first tile for which the coderef returns the maximum value.

_calculate_path Tile, Tile[, ARGS] -> Str, Bool, Level

Used internally by calculate_path -- returns just (path, complete, level), where level is the level that the path ended on (not necessarily to->level if the path was incomplete).

_calculate_intralevel_path Tile, Tile[, ARGS] -> Str, Bool

Same as _calculate_path, except the Tiles are supposed to be on the same level. This is to simplify some internals. The results are undefined if the tiles are not on the same level (most likely there'll be a controlled detonation).

_dijkstra Code, ARGS -> Tile, Str

This performs a search for some tile. The code reference is evaluated for each tile along the way. It receives the current tile, the path to it, and the path's cost thus far as its arguments. It's expected to return one of the following:

The string 'q'

This indicates that the search may be short-circuited, returning this tile. This can be used when searching for a known tile.

A number

This is used to score relative tiles. The tile with the maximum score will be returned from _dijkstra.

undef

This is used to indicate that the current tile is not a valid solution.

The optional arguments are:

from (default: TAEB->current_tile)

The starting tile

through_unknown (default: false)

Whether to assume unknown tiles are walkable

include_endpoints (default: false)

Whether to include nonwalkable endpoints in the scorer checks (in essence, do you want to include monsters, walls, etc as targets?)

_astar Tile, ARGS -> Maybe[Str]

syntax highlighting: