diff --git a/src/complexagent.rs b/src/complexagent.rs index 8404a26..fe273ac 100644 --- a/src/complexagent.rs +++ b/src/complexagent.rs @@ -17,9 +17,9 @@ impl Agent for ComplexAgent { .collect::>() }) .map(|(i, j)| (i, j, board.move_would_propegate(i, j, self.color))) - .filter(|&(_, _, c)| c >= 0) + .filter(|&(_, _, c)| c >= 0) // a `c` value of less than 0 implies the move is invalid: TODO! make this an enum or smth .max_by_key(|&(_, _, c)| c) - .map(|(i, j, _)| (i, j)) + .map(|(i, j, _)| (i, j)) // remove `c` and return the best move } fn name(&self) -> &'static str { diff --git a/src/misc.rs b/src/misc.rs index 1b1d63c..5630cd8 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -22,29 +22,6 @@ where output } -pub fn offsets(i: usize, j: usize, range: usize) -> Vec<(usize, usize)> { - let mut output = Vec::new(); - for i_o in [-(range as i16), 0, range as i16] { - let new_i = i as i16 + i_o; - if 0 > new_i { - continue; - } - - for j_o in [-(range as i16), 0, range as i16] { - if (i_o, j_o) == (0, 0) { - continue; - } - let new_j = j as i16 + j_o; - if 0 > new_j { - continue; - } - output.push((new_i as usize, new_j as usize)); - } - } - - output -} - #[cfg(test)] mod test { use super::*;