fillEmpty method
- int color
If the color of the cell is the default color, then change it to the color passed in.
Args: color (int): The color to fill the empty spaces with.
Returns: A boolean value.
Implementation
bool fillEmpty(int color) {
for (int i = 0; i < _shape.grid.length; i++) {
for (int j = 0; j < _shape.grid[i].length; j++) {
if (_shape.validatePosition(i, j)) {
_shape.grid[i][j] =
_shape.grid[i][j] == _defaultColor ? color : _shape.grid[i][j];
}
}
}
return true;
}