Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions engine/src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,6 @@ impl<'a, Log: LogLevel> Search<'a, Log> {
return score;
}

// don't bother searching if the board is in a draw state
if board.is_draw() {
return Score::DRAW;
}

// get all legal moves
let mut move_list = MoveList::new();
let mut order_list = ArrayVec::<MoveOrder, MAX_MOVE_LIST_SIZE>::new();
Expand Down Expand Up @@ -497,7 +492,11 @@ impl<'a, Log: LogLevel> Search<'a, Log> {

// make the move
board.make_move_unchecked(&mv).unwrap();
let score : Score =
let mut score = Score::DRAW;

// Don't bother searching drawn positions
if !board.is_draw() {
score =
// Principal Variation Search (PVS)
if Node::PV && i == 0 {
-self.negamax::<PvNode>(board, depth - 1, ply + 1, -beta, -alpha_use, &mut local_pv)
Expand All @@ -517,6 +516,7 @@ impl<'a, Log: LogLevel> Search<'a, Log> {
temp_score
}
};
}

// undo the move
board.unmake_move().unwrap();
Expand Down