countOpenNeighbors method

int countOpenNeighbors(
  1. int x,
  2. int y
)

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;
}