示例#1
0
        private int SizeOfBasin(Point2 point, Grid2 <int> grid, bool[,] visited)
        {
            int size = 0;

            if (grid[point] != 9 && !visited[point.X, point.Y])
            {
                visited[point.X, point.Y] = true;
                size = point.Adjacent(grid.Bounds).Sum(adj => SizeOfBasin(adj, grid, visited)) + 1;
            }

            return(size);
        }