Class elca

elementary cellular automata

Methods

elca:new () constructor
elca:update () update all state
elca:neighbors (i) helper: return three values to use for neighbor code
elca:code (l, c, r) get binary code for value given cell and neighbors
elca:window (n) return 8 cells at current offset
elca:set_rule_by_state (val, l, c, r) change current state at index, and update the rule to that which would have produced the new state
elca:clear () clear all states


Methods

elca:new ()
constructor

Returns:

    elca
elca:update ()
update all state
elca:neighbors (i)
helper: return three values to use for neighbor code

Parameters:

  • i number

Returns:

    tuple of left, right, center
elca:code (l, c, r)
get binary code for value given cell and neighbors

Parameters:

  • l number left cell
  • c number center cell
  • r number right cell
elca:window (n)
return 8 cells at current offset

Parameters:

  • n number

Returns:

    table table with 8 binary values
elca:set_rule_by_state (val, l, c, r)
change current state at index, and update the rule to that which would have produced the new state

Parameters:

  • val
  • l
  • c
  • r
elca:clear ()
clear all states
generated by LDoc 1.4.6 Last updated 2020-03-28 23:45:19