Global

Type Definitions

CellState

A valid cell state - a boolean, a number, or a string.

Type:
  • boolean | number | string

GridCoordinate

A number representing an x or y coordinate within a cellular automaton. Specifically, an integer number greater than or equal to zero.

Type:
  • number

GridDimension

A number representing the total width or height of a cellular automaton as a number of cells. Specifically, an integer number greater than or equal to one.

Type:
  • number

initialisationFunction(x, y) → {CellState}

An initialisation function is used to set the initial states of each cell in a cellular automaton. The function will be called once for each cell, and it will return an initial state for each.

Parameters:
Name Type Description
x GridCoordinate

the zero-indexed X-coordinate of the cell being initialised within the cellular automaton's grid.

y GridCoordinate

the zero-indexed Y-coordinate of the cell being initialised within the cellular automaton's grid.

Returns:
Type:
CellState

an initial state.

jQueryObject

A jQuery object.

Type:
  • Object

jQuerySingleContainer

A jQuery object representing exactly one element which can be used as a container for a cellular automaton. The following tags are premitted:

  • div
  • p
  • main
  • section
See:
Type:

jQuerySingleTable

A jQuery object representing exactly one table (table).

See:
Type:

jQuerySingleTD

A jQuery object representing exactly one table data cell (td).

See:
Type:

PlainObject

An object created using {} or new Object(). jQuery's $.isPlainObject() function is used to validate this datatype.

Type:
  • Object

renderFunction(rFn, s)

A render function should style a table data cell so it represents a given state. This function will be used to render each cell in a cellular automaton.

Parameters:
Name Type Description
rFn jQuerySingleTD

a jQuery object representing the table data cell to be rendered.

s CellState

the state of the cell the table data cell represents.

stepFunction(currentState, neighbourStates) → {CellState}

A step function is used to calcualte the next value of each cell for each step the cellular automaton takes.

Parameters:
Name Type Description
currentState CellState

the curent state of the cell.

neighbourStates Array.<CellState>

the current state of each neighbouring cell as an array with the cell at 12 o'clock at index zero, and moving around the cell clockwise from there. If a cell is on an edge, there will still be array elements representing the non-existent neighbours, but they will have the valye null.

Returns:
Type:
CellState

the next state for the cell.