javascript automata

Published: 28 Jun 2016
  Tags: Web

Clone on github: https://github.com/benbyford/js-automata

Key

n - count neighbours one left one right of currrent cell.
n4 - count neighbours two left two right of currrent cell.

 

Logic: if n = 0 bring alive, n = 1 die, n = 2 alive

Logic 2: if self = 1 && n = 1 keep alive else die, else if self = 0 && n = 0 bring alive, else die

Logic 3: if n = 4 && self alove then die, n more than or 2 bring alive, else die

Logic 4: if n = 2 then if n4 = 3 alive else die, n = 1 then if n4 = 3 alive else die, if n = 0 bring alive

Logic 5: if n = 2 then if n4 > 2 & self = 1 then die else stay alive, if n = 1 then alive, if n = 0 and n4 > 1 then alive, if n4 = 0 and self dead then alive, else dead

© Ben Byford | website created by Ben Byford using Processwire