countClosedNeighbors method
The number of cardinal neighbors of the tile at column x
row y
that
are closed (not open)
Implementation
int countClosedNeighbors(int x, int y) {
int count = 0;
for (var n in neighbors(x, y)) {
if (!n.isOpen) count++;
}
return count;
}