fn valid_grid(&self) -> bool {
        let height = self.v_keys.len();
        let width = self.h_keys.len();
        let mut keys = Vec::with_capacity(10);
        for i in 0..height {
            keys.clear();
            let mut group = 0;
            let mut t = false;
            for j in 0..width {
                match self.grid[i][j].cell_state {
                    Status::Marked => {
                        group += 1;
                    }
                    Status::Empty => {
                        if group > 0 {
                            keys.push(group);
                        }
                        group = 0;
                    }
                    Status::Unknown => {
                        t = true;
                        break;
                    }
                }
            }

            if group > 0 && !t {
                keys.push(group);
            }
            if t {
                if !self.compare_keys_start(&keys, &self.v_keys[i]) {
                    return false;
                }
            } else {
                if keys.is_empty() {
                    keys.push(0);
                }
                if !self.compare_keys_whole(&keys, &self.v_keys[i]) {
                    return false;
                }
            }
        }
        for i in 0..width {
            keys.clear();
            let mut group = 0;
            let mut t = false;
            for j in 0..height {
                match self.grid[j][i].cell_state {
                    Status::Marked => group += 1,
                    Status::Empty => {
                        if group > 0 {
                            keys.push(group);
                        }
                        group = 0;
                    }
                    Status::Unknown => {
                        t = true;
                        break;
                    }
                }
            }
            if group > 0 && !t {
                keys.push(group);
            }
            if t {
                if !self.compare_keys_start(&keys, &self.h_keys[i]) {
                    return false;
                }
            } else {
                if keys.is_empty() {
                    keys.push(0);
                }
                if !self.compare_keys_whole(&keys, &self.h_keys[i]) {
                    return false;
                }
            }
        }

        true
    }
//Return false if a row/column consists of cells that don't correspond with the appropriate key set
Return false if a row/column consists of cells that don't correspond with the appropriate key set
Return false if a row / column consists of cells that don ' t correspond with the appropriate key set
fn valid_grid(&self) -> bool {
        let height = self.v_keys.len();
        let width = self.h_keys.len();
        let mut keys = Vec::with_capacity(10);
        for i in 0..height {
            keys.clear();
            let mut group = 0;
            let mut t = false;
            for j in 0..width {
                match self.grid[i][j].cell_state {
                    Status::Marked => {
                        group += 1;
                    }
                    Status::Empty => {
                        if group > 0 {
                            keys.push(group);
                        }
                        group = 0;
                    }
                    Status::Unknown => {
                        t = true;
                        break;
                    }
                }
            }
            if group > 0 && !t {
                keys.push(group);
            }
            if t {
                if !self.compare_keys_start(&keys, &self.v_keys[i]) {
                    return false;
                }
            } else {
                if keys.is_empty() {
                    keys.push(0);
                }
                if !self.compare_keys_whole(&keys, &self.v_keys[i]) {
                    return false;
                }
            }
        }
        for i in 0..width {
            keys.clear();
            let mut group = 0;
            let mut t = false;
            for j in 0..height {
                match self.grid[j][i].cell_state {
                    Status::Marked => group += 1,
                    Status::Empty => {
                        if group > 0 {
                            keys.push(group);
                        }
                        group = 0;
                    }
                    Status::Unknown => {
                        t = true;
                        break;
                    }
                }
            }
            if group > 0 && !t {
                keys.push(group);
            }
            if t {
                if !self.compare_keys_start(&keys, &self.h_keys[i]) {
                    return false;
                }
            } else {
                if keys.is_empty() {
                    keys.push(0);
                }
                if !self.compare_keys_whole(&keys, &self.h_keys[i]) {
                    return false;
                }
            }
        }
        true
    }
fn valid_grid ( & self ) -> bool { let height = self . v_keys . len ( ) ; let width = self . h_keys . len ( ) ; let mut keys = Vec :: with_capacity ( 10 ) ; for i in 0 .. height { keys . clear ( ) ; let mut group = 0 ; let mut t = false ; for j in 0 .. width { match self . grid [ i ] [ j ] . cell_state { Status :: Marked => { group += 1 ; } Status :: Empty => { if group > 0 { keys . push ( group ) ; } group = 0 ; } Status :: Unknown => { t = true ; break ; } } } if group > 0 && ! t { keys . push ( group ) ; } if t { if ! self . compare_keys_start ( & keys , & self . v_keys [ i ] ) { return false ; } } else { if keys . is_empty ( ) { keys . push ( 0 ) ; } if ! self . compare_keys_whole ( & keys , & self . v_keys [ i ] ) { return false ; } } } for i in 0 .. width { keys . clear ( ) ; let mut group = 0 ; let mut t = false ; for j in 0 .. height { match self . grid [ j ] [ i ] . cell_state { Status :: Marked => group += 1 , Status :: Empty => { if group > 0 { keys . push ( group ) ; } group = 0 ; } Status :: Unknown => { t = true ; break ; } } } if group > 0 && ! t { keys . push ( group ) ; } if t { if ! self . compare_keys_start ( & keys , & self . h_keys [ i ] ) { return false ; } } else { if keys . is_empty ( ) { keys . push ( 0 ) ; } if ! self . compare_keys_whole ( & keys , & self . h_keys [ i ] ) { return false ; } } } true }
Return false if a row/column consists of cells that don't correspond with the appropriate key set
Return false if a row / column consists of cells that don ' t correspond with the appropriate key set
&self
&self