mazeMovement/runtime

Runtime/environment helpers for the dedicated mazeMovement module.

This file is the environment-facing foundation beneath the rest of the mazeMovement stack. When the higher-level policy and shaping helpers need to ask what world the agent is actually inside, they depend on this boundary for cell-open checks, distance lookup, run-state creation, visit-ring bookkeeping, and perception-state updates.

The point of this split is to keep "what the maze world currently is" apart from "what the policy wants to do next" and "how that action should be rewarded." That separation makes the public facade easier to read because the hot path can be understood as environment refresh first, decision second, shaping third, and result folding last.

Read this file as the substrate for the rest of the module: runtime helpers define the world state that policy, shaping, and finalization build on top of.

mazeMovement/runtime/mazeMovement.runtime.ts

buildMazeMovementVisionAndDistance

buildMazeMovementVisionAndDistance(
  state: SimulationState,
  encodedMaze: number[][],
  exitPos: readonly [number, number],
  distanceMap: number[][] | undefined,
): void

Build the current perception vector and update distance-tracking state.

Parameters:

createMazeMovementRunState

createMazeMovementRunState(
  encodedMaze: number[][],
  startPos: readonly [number, number],
  distanceMap: number[][] | undefined,
  maxSteps: number,
): SimulationState

Create the initial run-state object for one simulation episode.

Parameters:

Returns: Fresh simulation state backed by the shared buffer pools.

getMazeMovementDistance

getMazeMovementDistance(
  encodedMaze: readonly (readonly number[])[],
  __1: readonly [number, number],
  distanceMap: number[][] | undefined,
): number

Resolve the current distance value for a maze coordinate.

Parameters:

Returns: Finite distance when present, otherwise Infinity.

getMazeMovementHistoryFromEnd

getMazeMovementHistoryFromEnd(
  state: SimulationState,
  nth: number,
): number | undefined

Return the nth most recent cell index from the visit-history ring.

Parameters:

Returns: The requested cell index or undefined when out of range.

isMazeMovementCellOpen

isMazeMovementCellOpen(
  encodedMaze: readonly (readonly number[])[],
  x: number,
  y: number,
  coordinateScratch: Int32Array<ArrayBufferLike>,
): boolean

Determine whether a maze cell is inside bounds and not a wall.

Parameters:

Returns: True when the target cell is within bounds and open.

pushMazeMovementHistory

pushMazeMovementHistory(
  state: SimulationState,
  cellIndex: number,
): void

Push a cell index into the circular visit-history ring.

Parameters:

recordMazeMovementVisitAndPenalties

recordMazeMovementVisitAndPenalties(
  state: SimulationState,
): void

Record the current cell visit and update visit-driven penalties.

Parameters:

Generated from source JSDoc • GitHub