From 0dac4a9a38f4d63bcd97e71b7e2662caacac6e11 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 28 Jan 2025 16:31:15 -0500 Subject: [PATCH] double prop is fake --- src/board.rs | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/src/board.rs b/src/board.rs index d156ac6..5fe07a8 100644 --- a/src/board.rs +++ b/src/board.rs @@ -125,11 +125,11 @@ impl Board { let Some(history) = chain.get(..chain_length) else { break; }; + captured += history.len(); // fill all opposite colors with this color for &(i_o, j_o) in history { 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, @@ -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)); - } }