Module: maze/obstaclePlacer

maze/obstaclePlacer

This module takes a matrix that represents a maze and returns a list of cells where obstacles will be placed.
Source:

Methods

<private, static> __anyOfObjectAreInList(list1, list2) → {boolean}

Check if any of the objects in `list2` are equal to the objects in `list1`.
Parameters:
Name Type Description
list1 Array.<Object> A list of objects.
list2 Array.<Object> A second list of objects.
Source:
Returns:
True if any of the objects in `list1` is equal to any of the objects in `list2`.
Type
boolean

<private, static> __objectIsInList(listOfObjects, object) → {boolean}

See if a object is in a list of objects.
Parameters:
Name Type Description
listOfObjects Array.<Object> A list of objects.
object Object The object that should be checked against the list.
Source:
Returns:
True if `object` is equal to any of the objects in `listOfObjects`, false otherwise.
Type
boolean

<static> place(maze, ignoreCells, numberOfObstacles) → {Array.<Object>}

Create and get coordinates for a number of obstacles. None of the obstacles will be adjacent to each other.
Parameters:
Name Type Description
maze Array.<Array.<Object>> A matrix that represents a maze.
Properties
Name Type Description
wall boolean If it's a wall or floor.
ignoreCells Array.<Object> A list of cells to ignore even if they are floor cells.
Properties
Name Type Description
x number
y number
numberOfObstacles number The maximum number of obstacles that will be placed into the maze.
Source:
Returns:
A list of cells where the obstacles should be placed. Each list element is an object with the attributes `x` and `y`.
Type
Array.<Object>