SplayTreeGrid<E>.generate  constructor 
Creates a new splay tree grid with the given width and height.
Each element in the grid is initialized by calling generator with the
position of the element. The empty element is used as the default value.
The width and height must be positive.
Example
final grid = SplayTreeGrid.generate(2, 2, (pos) => pos.x + pos.y, empty: 0);
print(grid.get(Pos(0, 0))); // 0
print(grid.get(Pos(1, 0))); // 1
Implementation
factory SplayTreeGrid.generate(
  int width,
  int height,
  E Function(Pos) generator, {
  required E empty,
}) {
  checkPositive(width, 'width');
  checkPositive(height, 'height');
  final grid = SplayTreeGrid<E>.filled(width, height, empty: empty);
  for (var y = 0; y < height; y++) {
    for (var x = 0; x < width; x++) {
      grid.setUnsafe(Pos(x, y), generator(Pos(x, y)));
    }
  }
  return grid;
}