Skip to content

Commit

Permalink
extend checks during quiescence
Browse files Browse the repository at this point in the history
  • Loading branch information
brunocodutra committed Sep 15, 2023
1 parent 7473021 commit 3e7b2c5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/search/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ impl Engine {

let score = match tpos {
Some(t) => t.score().normalize(ply),
None if ply < depth => self.nw::<1>(pos, beta, ply.cast(), ply, timer)?.score(),
None => pos.value().cast(),
None if ply >= depth => pos.value().cast(),
None => self.nw::<1>(pos, beta, ply.cast(), ply, timer)?.score(),
};

if ply >= Ply::UPPER {
Expand All @@ -186,10 +186,10 @@ impl Engine {
}
}

let kind = if ply < depth {
MoveKind::ANY
} else {
let kind = if ply >= depth && !in_check {
MoveKind::CAPTURE | MoveKind::PROMOTION
} else {
MoveKind::ANY
};

let mut moves = ArrayVec::<_, 256>::from_iter(pos.moves(kind).map(|m| {
Expand Down Expand Up @@ -344,12 +344,12 @@ mod tests {
None => pos.value().cast(),
};

let kind = if ply < depth {
MoveKind::ANY
} else if ply < Ply::UPPER {
let kind = if ply >= Ply::UPPER {
return score;
} else if ply >= depth && !pos.is_check() {
MoveKind::CAPTURE | MoveKind::PROMOTION
} else {
return score;
MoveKind::ANY
};

pos.moves(kind)
Expand Down

0 comments on commit 3e7b2c5

Please sign in to comment.