fn bishop_delta(dim: &Dimensions, i: usize, j: usize) -> isize {
   let diff = j as isize - i as isize;
   let icols = dim.cols as isize;
   diff.signum() *  (icols + if diff % (icols+1) == 0 { 1 } else { -1 }) 
}
/// Determine the write value to add to i, to take you
/// diagonally to j
Determine the write value to add to i, to take you
diagonally to j
Determine the write value to add to i to take you diagonally to j
fn bishop_delta(dim: &Dimensions, i: usize, j: usize) -> isize {
   let diff = j as isize - i as isize;
   let icols = dim.cols as isize;
   diff.signum() *  (icols + if diff % (icols+1) == 0 { 1 } else { -1 }) 
}
fn bishop_delta ( dim : & Dimensions , i : usize , j : usize ) -> isize { let diff = j as isize - i as isize ; let icols = dim . cols as isize ; diff . signum ( ) * ( icols + if diff % ( icols + 1 ) == 0 { 1 } else { - 1 } ) }
Determine the write value to add to i, to take you
diagonally to j
Determine the write value to add to i to take you diagonally to j
dim
&Dimensions
i
usize
j
usize
dim
&Dimensions
i
usize
j
usize