Class: Cell

Maze~Cell(index, visitedopt)

Box with additional information such as position on a grid and if the cell has been visited or not.

Constructor

new Cell(index, visitedopt)

Initialize a cell object.

Parameters:
Name Type Attributes Default Description
index GridIndex

GridIndex of the cell instance on a 2D grid.

visited boolean <optional>
false

If the cell has been visited or not.

Source:

Extends

Members

down

Properties:
Name Type Description
down boolean

Bottom-side wall of the box.

Overrides:
Source:

index

Properties:
Name Type Description
index GridIndex

Position on a 2D grid.

Source:

left

Properties:
Name Type Description
left boolean

Left-side wall of the box.

Overrides:
Source:
Properties:
Name Type Description
right boolean

Right-side wall of the box.

Overrides:
Source:

up

Properties:
Name Type Description
up boolean

Top-side wall of the box.

Overrides:
Source:

visited

Properties:
Name Type Description
visited boolean

If the cell has been visited or not.

Source:

Methods

getNeighborIndices() → {Map.<string, GridIndex>}

Fetch all the possible adjacent neighbors on a grid based off of the cell's position.

Source:
Returns:
  • A map of each adjacent neighbor keyed to the respective direction of that neighbor.
Type
Map.<string, GridIndex>

setWalls(enable)

Sets all of the walls either on or off.

Parameters:
Name Type Description
enable boolean

To toggle on or off.

Overrides:
Source:

toggleOpposite(wall, enable)

Wrapper method to change the visibility of the opposite Wall in the box based off of a string. Felt much easier to just use a switch statement here rather than reuse Box.toggleWall.

Parameters:
Name Type Description
wall Box.WALLS

What wall that will be the opposite of the toggled wall.

enable boolean

To toggle on or off.

Overrides:
Source:
Example
Box.toggleOpposite('LEFT', true) // Toggles the right wall on.

toggleWall(wall, enable)

Wrapper method to change the visibility of a given Wall in the box based off of a string.

Parameters:
Name Type Description
wall Box.WALLS

What wall to toggle.

enable boolean

To toggle on or off.

Overrides:
Source: