double prop is fake

This commit is contained in:
2025-01-28 16:31:15 -05:00
parent 0f47a5db06
commit 0dac4a9a38

View File

@@ -125,11 +125,11 @@ impl Board {
let Some(history) = chain.get(..chain_length) else { let Some(history) = chain.get(..chain_length) else {
break; break;
}; };
captured += history.len();
// fill all opposite colors with this color // fill all opposite colors with this color
for &(i_o, j_o) in history { for &(i_o, j_o) in history {
self.place_unchecked(i_o, j_o, starting_color); self.place_unchecked(i_o, j_o, starting_color);
captured += self.propegate_from(i_o, j_o) + 1;
} }
} }
// either the other pieces were replaced, or this was an invalid chain, // either the other pieces were replaced, or this was an invalid chain,
@@ -241,46 +241,4 @@ mod test {
); );
} }
} }
#[test]
fn double_prop() {
let mut board = Board::new();
assert_eq!(board.place(0, 0, Piece::Black), Ok(()));
assert_eq!(board.place(0, 1, Piece::White), Ok(()));
// -----------------
// |□|■| | | | | | |
// -----------------
// | | | | | | | | |
assert_eq!(board.place(1, 1, Piece::White), Ok(()));
// -----------------
// |□|■| | | | | | |
// -----------------
// | |■| | | | | | |
assert_eq!(board.place(2, 1, Piece::Black), Ok(()));
// -----------------
// |□|■| | | | | | |
// -----------------
// | |■| | | | | | |
// -----------------
// | |□| | | | | | |
assert_eq!(board.place(0, 2, Piece::Black), Ok(()));
// -----------------
// |□|□|□| | | | | |
// -----------------
// | |□| | | | | | |
// -----------------
// | |□| | | | | | |
assert_eq!(board.get(0, 1), &Some(Piece::Black));
assert_eq!(board.get(1, 1), &Some(Piece::Black));
}
} }