fn update_board<W: Write>(&self, stdout: &mut W, vkey_max: &usize, hkey_max: &usize) {
        print_keys(&self, *hkey_max, *vkey_max, stdout);
        for (i, cell_set) in self.grid.iter().enumerate() {
            for (j, cell) in cell_set.iter().enumerate() {
                write!(
                    stdout,
                    "{}",
                    termion::cursor::Goto(
                        ((vkey_max + (vkey_max - 1) + 1) + (j * 5))
                            .try_into()
                            .unwrap(),
                        u16::try_from(hkey_max + 1 + (i * 2)).ok().unwrap()
                    )
                )
                .expect("Error updating grid");
                match cell.cell_state {
                    Status::Empty => println!(
                        "{fg}{}{reset_fg}",
                        CELL,
                        fg = color::Fg(color::White),
                        reset_fg = color::Fg(color::Reset)
                    ),
                    Status::Marked => println!(
                        "{fg}{}{reset_fg}",
                        CELL,
                        fg = color::Fg(color::Black),
                        reset_fg = color::Fg(color::Reset)
                    ),
                    Status::Unknown => println!("{}", UNKNOWN),
                }
                write!(
                    stdout,
                    "{}",
                    termion::cursor::Goto(
                        ((vkey_max + (vkey_max - 1) + 1) + (j * 5))
                            .try_into()
                            .unwrap(),
                        u16::try_from(hkey_max + 1 + (i * 2) + 1).ok().unwrap()
                    )
                )
                .expect("Error updating grid");
                match cell.cell_state {
                    Status::Empty => println!(
                        "{fg}{}{reset_fg}",
                        CELL,
                        fg = color::Fg(color::White),
                        reset_fg = color::Fg(color::Reset)
                    ),
                    Status::Marked => println!(
                        "{fg}{}{reset_fg}",
                        CELL,
                        fg = color::Fg(color::Black),
                        reset_fg = color::Fg(color::Reset)
                    ),
                    Status::Unknown => println!("{}", UNKNOWN),
                }
            }
        }
        write!(
            stdout,
            "{}",
            termion::cursor::Goto(1, (self.size[0] * 2 + 5).try_into().unwrap())
        )
        .expect("Error updating board");

        stdout.flush().unwrap();
    }
//Prints the complete grid in the terminal
Prints the complete grid in the terminal
Prints the complete grid in the terminal
fn update_board<W: Write>(&self, stdout: &mut W, vkey_max: &usize, hkey_max: &usize) {
        print_keys(&self, *hkey_max, *vkey_max, stdout);
        for (i, cell_set) in self.grid.iter().enumerate() {
            for (j, cell) in cell_set.iter().enumerate() {
                write!(
                    stdout,
                    "{}",
                    termion::cursor::Goto(
                        ((vkey_max + (vkey_max - 1) + 1) + (j * 5))
                            .try_into()
                            .unwrap(),
                        u16::try_from(hkey_max + 1 + (i * 2)).ok().unwrap()
                    )
                )
                .expect("Error updating grid");
                match cell.cell_state {
                    Status::Empty => println!(
                        "{fg}{}{reset_fg}",
                        CELL,
                        fg = color::Fg(color::White),
                        reset_fg = color::Fg(color::Reset)
                    ),
                    Status::Marked => println!(
                        "{fg}{}{reset_fg}",
                        CELL,
                        fg = color::Fg(color::Black),
                        reset_fg = color::Fg(color::Reset)
                    ),
                    Status::Unknown => println!("{}", UNKNOWN),
                }
                write!(
                    stdout,
                    "{}",
                    termion::cursor::Goto(
                        ((vkey_max + (vkey_max - 1) + 1) + (j * 5))
                            .try_into()
                            .unwrap(),
                        u16::try_from(hkey_max + 1 + (i * 2) + 1).ok().unwrap()
                    )
                )
                .expect("Error updating grid");
                match cell.cell_state {
                    Status::Empty => println!(
                        "{fg}{}{reset_fg}",
                        CELL,
                        fg = color::Fg(color::White),
                        reset_fg = color::Fg(color::Reset)
                    ),
                    Status::Marked => println!(
                        "{fg}{}{reset_fg}",
                        CELL,
                        fg = color::Fg(color::Black),
                        reset_fg = color::Fg(color::Reset)
                    ),
                    Status::Unknown => println!("{}", UNKNOWN),
                }
            }
        }
        write!(
            stdout,
            "{}",
            termion::cursor::Goto(1, (self.size[0] * 2 + 5).try_into().unwrap())
        )
        .expect("Error updating board");
        stdout.flush().unwrap();
    }
fn update_board < W : Write > ( & self , stdout : & mut W , vkey_max : & usize , hkey_max : & usize ) { print_keys ( & self , * hkey_max , * vkey_max , stdout ) ; for ( i , cell_set ) in self . grid . iter ( ) . enumerate ( ) { for ( j , cell ) in cell_set . iter ( ) . enumerate ( ) { write ! ( stdout " " termion cursor Goto ( ( ( vkey_max ( vkey_max 1 ) 1 ) ( j 5 ) ) try_into ( ) unwrap ( ) u16 try_from ( hkey_max 1 ( i 2 ) ) ok ( ) unwrap ( ) ) ) . expect ( " " ) ; match cell . cell_state { Status :: Empty => println ! ( " " CELL fg color Fg ( color White ) reset_fg color Fg ( color Reset ) ) , Status :: Marked => println ! ( " " CELL fg color Fg ( color Black ) reset_fg color Fg ( color Reset ) ) , Status :: Unknown => println ! ( " " UNKNOWN ) , } write ! ( stdout " " termion cursor Goto ( ( ( vkey_max ( vkey_max 1 ) 1 ) ( j 5 ) ) try_into ( ) unwrap ( ) u16 try_from ( hkey_max 1 ( i 2 ) 1 ) ok ( ) unwrap ( ) ) ) . expect ( " " ) ; match cell . cell_state { Status :: Empty => println ! ( " " CELL fg color Fg ( color White ) reset_fg color Fg ( color Reset ) ) , Status :: Marked => println ! ( " " CELL fg color Fg ( color Black ) reset_fg color Fg ( color Reset ) ) , Status :: Unknown => println ! ( " " UNKNOWN ) , } } } write ! ( stdout " " termion cursor Goto ( 1 ( self size [ 0 ] 2 5 ) try_into ( ) unwrap ( ) ) ) . expect ( " " ) ; stdout . flush ( ) . unwrap ( ) ; }
Prints the complete grid in the terminal
Prints the complete grid in the terminal
&self
stdout
&mut W
vkey_max
&usize
hkey_max
&usize
&self
stdout
&mut W
vkey_max
&usize
hkey_max
&usize