Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Neighbors solution in Clear category for [old] Moore Neighbourhood by bryanandrade
"use strict";
function countNeighbours(data, row, col){
var s = 0, adj = [[-1, 1], [-1, 0], [-1, -1], [0, 1], [0, -1], [1, 1], [1, 0], [1, -1]];
for (let a of adj){
let x = row + a[0], y = col + a[1];
if (data[x] && data[x][y]) s++;
}
return s;
}
July 9, 2016
Comments: