in 11-Other/GameOfLife/Program.cs [59:82]
static int CountNeighbours(int x, int y)
{
int x1, y1, count = 0;
for (int sx = x - 1; sx < x + 2; sx++)
{
for (int sy = y - 1; sy < y + 2; sy++)
{
if ((sx == x) && (sy == y))
{
// don't count self
continue;
}
x1 = sx;
y1 = sy;
EdgeWrap(ref x1, ref y1);
if (currentLife[x1, y1] == 1)
{
count++;
}
}
}
return count;
}