console_games/games/
mine_sweeper.rs

1use crate::Play;
2use console::Term;
3pub struct MineSweeper;
4mod internal;
5
6impl Play for MineSweeper {
7    fn name(&self) -> &'static str {
8        "Mine Sweeper"
9    }
10
11    fn start(&self) {
12        let size: usize = internal::prompt_field_size();
13        Term::stdout().clear_screen().unwrap();
14        internal::MineSweeper::new(size).start();
15    }
16
17    fn instructions(&self) -> Option<&'static str> {
18        Some("Enter x and y coordinates to reveal a cell. Enter 'f' before the coordinates to flag a cell.")
19    }
20}