From 94bd4ec01cb646fc34a945a31559bea2232b86ec Mon Sep 17 00:00:00 2001 From: dece Date: Sun, 28 Jun 2020 19:53:11 +0200 Subject: [PATCH] readme: update and minor fixes --- README.md | 3 ++- src/board.rs | 2 +- src/rules.rs | 12 +++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d70b79e..4316f95 100644 --- a/README.md +++ b/README.md @@ -77,10 +77,11 @@ TODO ---- - [X] Support time constraints -- [ ] Unmake mechanism instead of allocating nodes like there is no tomorrow +- [X] Unmake mechanism instead of allocating nodes like there is no tomorrow - [X] Precompute some pieces moves, maybe (done for knights) - [ ] Transposition table that does not actually slows search down - [ ] Check Zobrist hashes for previous point - [X] Actual bitboard - [ ] Some kind of move ordering could be great - [ ] Multithreading (never) +- [ ] Avoid 3-fold repetitions when winning diff --git a/src/board.rs b/src/board.rs index f44a072..0cb4941 100644 --- a/src/board.rs +++ b/src/board.rs @@ -439,7 +439,7 @@ impl Board { /// combination of squares either empty or occupied by an enemy /// piece they can reach. /// - /// If `protection` is true, consider friend pieces in rays as well. + /// If `protection` is true, include friend pieces in rays as well. fn get_blockable_rays( &self, square: Square, diff --git a/src/rules.rs b/src/rules.rs index 32dcac3..4ec8b08 100644 --- a/src/rules.rs +++ b/src/rules.rs @@ -97,7 +97,7 @@ fn get_piece_moves( match piece { PAWN => { board.get_pawn_progresses(square, color) - | board.get_pawn_captures(square, color) + | board.get_pawn_captures(square, color) } KING => board.get_king_rays(square, color), BISHOP => board.get_bishop_rays(square, color), @@ -541,6 +541,16 @@ mod tests { assert!(!is_illegal(&mut b, &mut gs, &mut Move::new(E1, F1))); let all_wh_moves = get_piece_moves(&mut b, &mut gs, E1, WHITE); assert_eq!(all_wh_moves.len(), 2); + + let mut b = Board::new_empty(); + let mut gs = GameState::new(); + + // Pin a pawn with an enemy bishop. + b.set_square(E1, WHITE, KING); + b.set_square(F2, WHITE, PAWN); + b.set_square(H4, BLACK, BISHOP); + assert!(is_illegal(&mut b, &mut gs, &mut Move::new(F2, F3))); + assert!(is_illegal(&mut b, &mut gs, &mut Move::new(F2, F4))); } #[test]