pub fn is_legitimate(pool: &[Vec]) -> Option { for row in pool { if *row.first()? == 1 || *row.last()? == 1 { return Some(false); } } for first_row in pool.first()? { if *first_row == 1 { return Some(false); } } for last_row in pool.last()? { if *last_row == 1 { return Some(false); } } Some(true) }