BoardState({required this.rows, required this.cols, List<List<Cell>>? grid}) : grid = grid ?? List.generate(rows, (_) => List.generate(cols, (_) => const Cell.empty()));