fn look<F>(board: &Board, i: usize, j: usize, max_y: i32, max_x: i32, peer: F) -> usize
where
    F: Fn(i32, i32) -> (i32, i32),
{
    let (mut y, mut x) = peer(i as i32, j as i32);
    if !in_bounds(y, x, max_y, max_x) {
        return 0;
    }
    while board[y as usize][x as usize] == FLOOR {
        let peered = peer(y, x);
        y = peered.0;
        x = peered.1;
        if !in_bounds(y, x, max_y, max_x) {
            return 0;
        }
    }
    if board[y as usize][x as usize] == BUSY {
        1
    } else {
        0
    }
}
// 0 if can't see a busy seat, 1 if can see one
0 if can't see a busy seat, 1 if can see one
0 if can ' t see a busy seat 1 if can see one
fn look<F>(board: &Board, i: usize, j: usize, max_y: i32, max_x: i32, peer: F) -> usize
where
    F: Fn(i32, i32) -> (i32, i32),
{
    let (mut y, mut x) = peer(i as i32, j as i32);
    if !in_bounds(y, x, max_y, max_x) {
        return 0;
    }
    while board[y as usize][x as usize] == FLOOR {
        let peered = peer(y, x);
        y = peered.0;
        x = peered.1;
        if !in_bounds(y, x, max_y, max_x) {
            return 0;
        }
    }
    if board[y as usize][x as usize] == BUSY {
        1
    } else {
        0
    }
}
fn look < F > ( board : & Board , i : usize , j : usize , max_y : i32 , max_x : i32 , peer : F ) -> usize where F : Fn ( i32 , i32 ) -> ( i32 , i32 ) , { let ( mut y , mut x ) = peer ( i as i32 , j as i32 ) ; if ! in_bounds ( y , x , max_y , max_x ) { return 0 ; } while board [ y as usize ] [ x as usize ] == FLOOR { let peered = peer ( y , x ) ; y = peered . 0 ; x = peered . 1 ; if ! in_bounds ( y , x , max_y , max_x ) { return 0 ; } } if board [ y as usize ] [ x as usize ] == BUSY { 1 } else { 0 } }
0 if can't see a busy seat, 1 if can see one
0 if can ' t see a busy seat 1 if can see one
board
&Board
i
usize
j
usize
max_y
i32
max_x
i32
peer
F