minesweeper_core/
cell.rs

1use crate::graphics::Point;
2
3#[derive(Debug, Copy, Clone, Default)]
4pub struct Cell {
5    pub number: i8,
6    pub cleared: bool,
7    pub flagged: bool,
8    pub coordinates: Point,
9}
10
11impl Cell {
12    pub fn is_mine(&self) -> bool {
13        self.number.is_negative()
14    }
15
16    pub fn new_mine(coordinates: Point) -> Cell {
17        Cell {
18            number: -1,
19            coordinates,
20            ..Default::default()
21        }
22    }
23}