Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
iterating solution in Clear category for [old] Moore Neighbourhood by ZoltanOnody
"use strict";
const countNeighbours = (data, row, col) => {
let ans = 0;
for(let i = row-1; i <= row+1; i++)
for(let j=col-1; j <= col+1; j++)
if(i !== row || j !== col)
ans += (data[i]||[])[j] || 0;
return ans;
}
July 20, 2016
Comments: