Struct sweeprs::Board [−][src]
pub struct Board { /* fields omitted */ }
Expand description
Default implementation of the SweeperBoard trait
Implementations
Helper methods to help implement the trait
Trait Implementations
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.
Open a cell, propagate if all neighboring cell is a free cell. Opening an opened cell will propagate if flagged cell count is equal to surrounding mine count.
Propagation is stopped when propagation reached a mine cell.
Flag a cell. Flagged cell cannot be opened until unflagged. Remove the flag by flagging a flagged cell again. Flagged cell counts toward opening an opened cell propagation.