Board

Board

The main model object in the game.

Holds a 40×25 grid of Cell objects (indexed cells[x][y], x-major), tracks the player's position, adjacent board references (for board-to-board navigation), and animation state.

Board is a plain data model — rendering is handled by the board-view module. Change notifications are delivered by calling registered listeners whenever a cell's state is mutated.

Constructor

new Board()

Source:

Classes

Board

Members

adjacentBoards

Description:
  • direction name → board path stem (e.g. "north" → "desert.rimmos")

Source:

direction name → board path stem (e.g. "north" → "desert.rimmos")

animated :Array.<AnimationProxy>

Description:
  • List of AnimationProxy objects — one per animated piece currently on the board. Maintained by Cell as agents/terrain are placed and removed.

Source:

List of AnimationProxy objects — one per animated piece currently on the board. Maintained by Cell as agents/terrain are placed and removed.

Type:

boardID

Description:
  • Path stem identifying this board, e.g. "tutorial/start".

Source:

Path stem identifying this board, e.g. "tutorial/start".

folder

Description:
  • Scenario folder name (e.g. "malloc-wizard"). Used by the editor to resolve adjacent board paths without needing the full server path.

Source:

Scenario folder name (e.g. "malloc-wizard"). Used by the editor to resolve adjacent board paths without needing the full server path.

outside

Description:
  • True if the board is set outdoors (affects symbol color rendering).

Source:

True if the board is set outdoors (affects symbol color rendering).

playerX

Description:
  • Current player column (-1 if not placed).

Source:

Current player column (-1 if not placed).

playerY

Description:
  • Current player row (-1 if not placed).

Source:

Current player row (-1 if not placed).

startX

Description:
  • Default player entry column when entering without a transition.

Source:

Default player entry column when entering without a transition.

startY

Description:
  • Default player entry row when entering without a transition.

Source:

Default player entry row when entering without a transition.

visitCount

Description:
  • Monotonically increasing counter stamped onto each cell the player visits. Used for breadcrumb-style pathfinding.

Source:

Monotonically increasing counter stamped onto each cell the player visits. Used for breadcrumb-style pathfinding.

Methods

addAnimated()

Description:
  • Register an animated piece at (x, y). Called by Cell when an agent or terrain with an onFrame method is placed.

Source:

find()

Description:
  • Find the first cell matching filter(cell)

Source:

findRandomCell()

Description:
  • Find a random traversable cell with no agent present.

Source:

fireColorEvent()

Description:
  • Broadcast a color event to all terrain and agents on the board. Each piece's onColorEvent() is called; pieces compare their own color to decide whether to react. The cell that fires the event is set on the event as originCell.

Source:

getAdjacentCell()

Description:
  • Return the cell adjacent to (x, y) in dir, or null.

Source:

getCellAt()

Description:
  • Return the cell at (x, y), or null if out-of-bounds.

Source:

getCurrentCell()

Description:
  • Return the cell currently occupied by the player.

Source:

hasNonTransientEffect()

Description:
  • True if any cell has a non-transient effect (used to delay saving).

Source:

moveAnimated()

Description:
  • Update the (x, y) of the proxy for piece when it moves to an adjacent cell without being removed and re-added. Called by Cell.moveAgentTo.

Source:

onCellChange()

Description:
  • Register a callback invoked whenever a cell's state changes.

Source:

removeAnimated()

Description:
  • Deregister the proxy for piece at (x, y). Called by Cell when an agent or animated terrain is removed.

Source:

visit()

Description:
  • Call visitor(cell) for every cell on the board. Function should return false to short-circuit the visitor

Source:

visitRange(center, range, includeCenter, visitor)

Description:
  • Visit cells in expanding rings around center, closest first. visitor(cell, dist) should return false to stop early.

Source:
Parameters:
Name Type Description
center Cell
range number
includeCenter boolean
visitor function