Global

Type Definitions

TCellState

A valid cell state, i.e. a boolean, a number, or a string.

Type:
  • boolean | number | string

TGridCoordinate

A number representing an x or y coordinate within a CA. Specifically, a whole number greater than or equal to zero.

Type:
  • number

TGridDimension

The total width or height of a cellular automaton in number of cells. Specifically, a whole number greater than or equal to one.

Type:
  • number

FinitialisationFunction(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.

TIntervalMS

A time interval as a number of milliseconds, must be a whole number greater than zero.

Type:
  • number

TjQuerySingleContainer

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

  • div
  • p
  • main
  • section
Type:

TjQuerySingleTable

A jQuery object representing exactly one table element.

Type:

TjQuerySingleTD

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

Type:

TPlainObject

A plain JavaScript object, i.e. an object with no prototype other than Object.

jQuery's $.isPlainObject() function is used to validate this type.

See:
Type:
  • Object

FrenderFunction(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.

FstepFunction(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.