Cell

data class Cell(val col: Int, val row: Int)(source)

A discrete cell in a GridProjection addressed by integer column / row coordinates.

Convention used throughout the agent layer: col is the x-direction (0 at the left, increasing right) and row is the y-direction (0 at the top or bottom — the projection treats them symmetrically). Distance helpers are provided for the three standard grid metrics; see GridMetric.

Constructors

Link copied to clipboard
constructor(col: Int, row: Int)

Properties

Link copied to clipboard
val col: Int
Link copied to clipboard
val row: Int

Functions

Link copied to clipboard

Chebyshev (king-move) distance — max(|Δcol|, |Δrow|). This is the radius used by the Moore neighborhood: cells within Chebyshev distance 1 form the 8-cell ring around this one.

Link copied to clipboard

Straight-line (Euclidean) distance, computed in cell units.

Link copied to clipboard

Manhattan (taxicab) distance — |Δcol| + |Δrow|. This is the radius used by the Von Neumann neighborhood: cells within Manhattan distance 1 form the 4-cell cross around this one.

Link copied to clipboard

Octile (king-move with √2 diagonals) distance: the exact minimum cost from this cell to other on a uniform-cost Moore-movement grid with orthogonal cost 1 and diagonal cost √2. The natural admissible heuristic for A* on such a grid.