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