Skip to main content

guards_grid

Function guards_grid 

Source
pub fn guards_grid(
    map: &str,
    guards: &[(u32, u32)],
) -> Option<BenchmarkGraph<2>>
Expand description

A GUARDS-based bi-objective grid (Section 4.4) from a Moving AI map and guard cells: an eight-connected directed graph over the passable cells, objectives path length (10 per orthogonal, 14 per diagonal move) and guard exposure. A cell’s exposure is the number of guards that see it (Bresenham line of sight through passable cells); an orthogonal move costs the destination’s exposure, a diagonal one the largest of the destination and the two side cells, and is allowed only when both side cells are passable. Cell (x, y) is state y · width + x; blocked cells have no edges.

The map format is Moving AI’s: a header with height and width lines, a map line, then one row per line, ., G and S passable.

Returns None if the header or a row is malformed, or the map has more cells than u32 states.

§Panics

Never: cell indices are checked against the map size.