aboutsummaryrefslogtreecommitdiff
path: root/src/grossmeister/search.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/grossmeister/search.rs')
-rw-r--r--src/grossmeister/search.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/grossmeister/search.rs b/src/grossmeister/search.rs
index cd9389d..5c03887 100644
--- a/src/grossmeister/search.rs
+++ b/src/grossmeister/search.rs
@@ -133,8 +133,12 @@ impl Grossmeister {
}
}
- if !legal_move_found && self.board.is_king_in_check(color) {
- return (-VALUE_WIN, principal_variation);
+ if !legal_move_found {
+ if self.board.is_king_in_check(color) {
+ return (-VALUE_WIN, principal_variation);
+ } else {
+ return (0.0, principal_variation);
+ }
}
(alpha, principal_variation)
@@ -208,7 +212,7 @@ impl Grossmeister {
let search_result = self.negamax_search(alpha, beta, depth, &mut root_killers);
if search_result.0.abs() >= VALUE_WIN {
- // TODO: do a mate search to print mate in X
+ println!("info mate {:.0}", (search_result.1.len() as f32 / 2.0).ceil(), );
result = Some(search_result);
break;
}