use mineswipe::grid::{Grid, State}; fn main() { let (rows, columns, mines) = (2, 3, 2); let mut grid = Grid::new(rows, columns, mines).unwrap(); while grid.state != State::Over { // Clear screen println!("{}[2J", 27 as char); // Print the grid println!("{:?}", grid); println!("Your move: "); let mut input= String::new(); std::io::stdin().read_line(&mut input).unwrap(); let action = input.as_bytes()[0] as char; let index = input.get(1..).unwrap().trim().parse::().unwrap(); if action == 'd' || action == 'D' { grid.dig(index).unwrap(); } else if action == 'f' || action == 'F' { grid.flag(index).unwrap(); } else { println!("Invalid input, try again!"); } } // Clear screen print!("{}[2J", 27 as char); // Print the grid println!("{:?}", grid); }