gol4.js
// handles interaction between pixel and neighbor according to sequence
handles interaction between pixel and neighbor according to sequence
handles interaction between pixel and neighbor according to sequence
function handle(i, p, nx, ny, s) {
  var who = neighbor(nx, ny);
  var what = s;
  if (who) {
    if (what == 0) {
      dead.push(p);
    } else if (what == 1) {
      world[i].life += who.life;
      dead.push(who);
    } else if (what == 3) {
    }
  } else {
    if (what == 2) {
      var c = {};
      c.x = nx;
      c.y = ny;
      c.life = world[i].life/2;
      create.push(c);
      world[i].life = world[i].life / 2;
    }
  }
}
function handle ( i , p , nx , ny , s ) { var who = neighbor ( nx , ny ) ; var what = s ; if ( who ) { if ( what == 0 ) { dead . push ( p ) ; } else if ( what == 1 ) { world [ i ] . life += who . life ; dead . push ( who ) ; } else if ( what == 3 ) { } } else { if ( what == 2 ) { var c = { } ; c . x = nx ; c . y = ny ; c . life = world [ i ] . life / 2 ; create . push ( c ) ; world [ i ] . life = world [ i ] . life / 2 ; } } }
handles interaction between pixel and neighbor according to sequence
handles interaction between pixel and neighbor according to sequence
// nothing