viva_aion/position
Position - Discrete coordinates in the labyrinth
Space is quantized. Consciousness moves in discrete steps. Between positions lies the Void.
Types
Cardinal directions for movement
pub type Direction {
Up
Down
Left
Right
}
Constructors
-
Up -
Down -
Left -
Right
Values
pub fn in_bounds(pos: Position, width: Int, height: Int) -> Bool
Check if position is within bounds
pub fn in_interior(
pos: Position,
width: Int,
height: Int,
) -> Bool
Check if position is within interior (not on border)
pub fn move_double(
pos: Position,
direction: Direction,
) -> Position
Move position by 2 steps (for maze generation)
pub fn neighbors_in_bounds(
pos: Position,
width: Int,
height: Int,
) -> List(Position)
Get neighbors within bounds
pub fn to_key(pos: Position, width: Int) -> Int
Convert position to unique integer key (for dict)