fn adjacent(pos: (usize, usize), bounds: (usize, usize)) -> Vec<(usize, usize)> {
    let mut v = Vec::with_capacity(4);
    let (r, c) = pos;
    let (r_max, c_max) = bounds;
    if r > 0 {
        v.push((r - 1, c));
    }
    if c > 0 {
        v.push((r, c - 1));
    }
    if r + 1 < r_max {
        v.push((r + 1, c));
    }
    if c + 1 < c_max {
        v.push((r, c + 1))
    }
    v
}
// the bounds here are strict, no tile can be placed there
the bounds here are strict, no tile can be placed there
the bounds here are strict no tile can be placed there
fn adjacent(pos: (usize, usize), bounds: (usize, usize)) -> Vec<(usize, usize)> {
    let mut v = Vec::with_capacity(4);
    let (r, c) = pos;
    let (r_max, c_max) = bounds;
    if r > 0 {
        v.push((r - 1, c));
    }
    if c > 0 {
        v.push((r, c - 1));
    }
    if r + 1 < r_max {
        v.push((r + 1, c));
    }
    if c + 1 < c_max {
        v.push((r, c + 1))
    }
    v
}
fn adjacent ( pos : ( usize , usize ) , bounds : ( usize , usize ) ) -> Vec < ( usize , usize ) > { let mut v = Vec :: with_capacity ( 4 ) ; let ( r , c ) = pos ; let ( r_max , c_max ) = bounds ; if r > 0 { v . push ( ( r - 1 , c ) ) ; } if c > 0 { v . push ( ( r , c - 1 ) ) ; } if r + 1 < r_max { v . push ( ( r + 1 , c ) ) ; } if c + 1 < c_max { v . push ( ( r , c + 1 ) ) } v }
the bounds here are strict, no tile can be placed there
the bounds here are strict no tile can be placed there
pos
(usize, usize)
bounds
(usize, usize)
pos
(usize, usize)
bounds
(usize, usize)