fn check_win(&self, i: usize) -> bool {
        // check if the row is completed
        let start_line = i - (i % 5);
        let mut possible = true;
        for k in 0..5 {
            if self.grid[start_line + k] >= 0 {
                possible = false;
                break;
            }
        }
        if possible {
            return true;
        }
        // check if the col is completed
        let col = i % 5;
        possible = true;
        for k in 0..5 {
            if self.grid[col + k * 5] >= 0 {
                possible = false;
                break;
            }
        }
        possible
    }
// Check if adding the last number at (row, col) made the board win
Check if adding the last number at (row, col) made the board win
Check if adding the last number at ( row col ) made the board win
fn check_win(&self, i: usize) -> bool {
        // check if the row is completed
        let start_line = i - (i % 5);
        let mut possible = true;
        for k in 0..5 {
            if self.grid[start_line + k] >= 0 {
                possible = false;
                break;
            }
        }
        if possible {
            return true;
        }
        // check if the col is completed
        let col = i % 5;
        possible = true;
        for k in 0..5 {
            if self.grid[col + k * 5] >= 0 {
                possible = false;
                break;
            }
        }
        possible
    }
fn check_win ( & self , i : usize ) -> bool { // check if the row is completed let start_line = i - ( i % 5 ) ; let mut possible = true ; for k in 0 .. 5 { if self . grid [ start_line + k ] >= 0 { possible = false ; break ; } } if possible { return true ; } // check if the col is completed let col = i % 5 ; possible = true ; for k in 0 .. 5 { if self . grid [ col + k * 5 ] >= 0 { possible = false ; break ; } } possible }
Check if adding the last number at (row, col) made the board win
Check if adding the last number at ( row col ) made the board win
&self
i
usize