AccessibilityTrie

data class AccessibilityTrie<T>(val origin: T, val maxMoveCost: Int, val neighbors: (T) -> List<T>, val isWalkable: (T) -> Boolean, val distance: (T, T) -> Int, val movementCost: (T, T) -> Double)(source)

A data class that represents a trie structure for accessibility in a hexagonal grid. Used for pathfinding and accessibility checks. Uses the A* algorithm to build the trie structure.

Parameters

T

The type of the elements in the grid.

origin

The starting point in the grid.

maxMoveCost

The maximum cost of moving from one point to another.

neighbors

A function that returns a list of neighbors for a given point.

isWalkable

A function that checks if a given point is walkable.

distance

A function that calculates the distance between two points.

movementCost

A function that calculates the cost of moving from one point to another.

Constructors

Link copied to clipboard
constructor(origin: T, maxMoveCost: Int, neighbors: (T) -> List<T>, isWalkable: (T) -> Boolean, distance: (T, T) -> Int, movementCost: (T, T) -> Double)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The set of all points accessible from the origin within maxMoveCost.

Link copied to clipboard
val distance: (T, T) -> Int
Link copied to clipboard
val isWalkable: (T) -> Boolean
Link copied to clipboard
Link copied to clipboard
val movementCost: (T, T) -> Double
Link copied to clipboard
val neighbors: (T) -> List<T>
Link copied to clipboard
val origin: T

Functions

Link copied to clipboard
fun build()

Builds the accessMap considering the walkable nodes, neighbors, and costs. Called automatically on initialization.

Link copied to clipboard
operator fun get(point: T): List<T>

Retrieves a list representing the path from the origin to the specified point using the predecessors stored in the access map.