fn new(height: usize, width: usize, mine_count: usize) -> Result<Self, Error> {
        if width < 9 || height < 9 || height * width - 9 < mine_count {
            return Err(Error::InvalidConfigError);
        }
        let cell = Cell {
            kind: CellKind::Uninitialized,
            state: CellState::Closed,
        };
        Ok(Self {
            cells: vec![vec![cell; width]; height],
            mine_count,
            state: BoardState::Uninitialized,
            closed_cell_count: width * height,
        })
    }
/// Create a new minesweeper board. `height` and `width` cannot be under 9,
/// while `mine_count` cannot exceed `height * width - 9` since the initial
/// cell and its neighbors must be a free cell. Return error if given invalid
/// configuration.
Create a new minesweeper board.
Create a new minesweeper board .
fn new(height: usize, width: usize, mine_count: usize) -> Result<Self, Error> {
        if width < 9 || height < 9 || height * width - 9 < mine_count {
            return Err(Error::InvalidConfigError);
        }
        let cell = Cell {
            kind: CellKind::Uninitialized,
            state: CellState::Closed,
        };
        Ok(Self {
            cells: vec![vec![cell; width]; height],
            mine_count,
            state: BoardState::Uninitialized,
            closed_cell_count: width * height,
        })
    }
fn new ( height : usize , width : usize , mine_count : usize ) -> Result < Self , Error > { if width < 9 || height < 9 || height * width - 9 < mine_count { return Err ( Error :: InvalidConfigError ) ; } let cell = Cell { kind : CellKind :: Uninitialized , state : CellState :: Closed , } ; Ok ( Self { cells : vec ! [ vec [ cell width ] height ] , mine_count , state : BoardState :: Uninitialized , closed_cell_count : width * height , } ) }
Create a new minesweeper board.
Create a new minesweeper board .
height
usize
width
usize
mine_count
usize
height
usize
width
usize
mine_count
usize