The algorithm I created (implementation of Conway's Game of Life's rules) doesn't match Conway's GoL. I've tried just about everything I can do, but it just doesn't match.
Additionally, if anyone knows how to make it into an infinite plane or perhaps wrap on itself, I'd be interested to see it implemented with my code!
Running JSFiddle: http://jsfiddle.net/jGkKF/2/
Pertinent code:
Checking the surrounding cells for live cells: (Line 28)
var x2 = x+1, x3 = x-1, y2 = y+1, y3 = y-1; // Math
if(tC[x][y3] !== undefined && tC[x][y3]) ne++; // T
if(tC[x][y2] !== undefined && tC[x][y2]) ne++; // TR
if(tC[x2] !== undefined) {
if(tC[x2][y]) ne++; // R
if(tC[x2][y3] !== undefined && tC[x2][y3]) ne++; // BR
if(tC[x2][y2] !== undefined && tC[x2][y2]) ne++; // B
}
if(tC[x3] !== undefined) {
if(tC[x3][y]) ne++; // BL
if(tC[x3][y3] !== undefined && tC[x3][y3]) ne++; // L
if(tC[x3][y2] !== undefined && tC[x3][y2]) ne++; // TL
}
And the algorithm: (Line 50)
if(cell && (ne < 2 || ne > 3)) cell = 0; // Over- or under- populated?
else if(!cell && ne == 3) cell = 1; // Give life?