Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: faster after-move
Browse files Browse the repository at this point in the history
raklaptudirm committed May 25, 2024

Verified

This commit was signed with the committer’s verified signature.
raklaptudirm Rak Laptudirm
1 parent 02fabf1 commit 37517b1
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions ataxx/src/position.rs
Original file line number Diff line number Diff line change
@@ -248,22 +248,17 @@ impl Position {
let xtm_pieces = self.bitboard(!stm);

let captured = BitBoard::single(m.target()) & xtm_pieces;
let from_to = BitBoard::from(m.target()) | BitBoard::from(m.source());

// Move the captured pieces from xtm to stm.
let new_xtm = xtm_pieces ^ captured;
let new_stm = stm_pieces ^ captured;

// Add a stm piece to the target square.
let mut new_stm = new_stm | BitBoard::from(m.target());
let new_stm = stm_pieces ^ captured ^ from_to;

// Reset half move clock on a singular move.
let mut half_move_clock = 0;

// Remove the piece from the source square if the move is non-singular.
if !m.is_single() {
new_stm ^= BitBoard::from(m.source());
// Jump move, so don't reset half move clock.
half_move_clock = self.half_move_clock + 1;
let half_move_clock = if m.is_single() {
0
} else {
self.half_move_clock + 1
};

let (white, black) = if stm == Piece::White {

0 comments on commit 37517b1

Please sign in to comment.