aboutsummaryrefslogtreecommitdiff
path: root/src/grossmeister/UCI.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/grossmeister/UCI.rs')
-rw-r--r--src/grossmeister/UCI.rs35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/grossmeister/UCI.rs b/src/grossmeister/UCI.rs
index 1e85b71..7c3cfb5 100644
--- a/src/grossmeister/UCI.rs
+++ b/src/grossmeister/UCI.rs
@@ -1,6 +1,6 @@
use std::{io::stdin, thread::Builder};
-use crate::{board::{Board, io::IO}, moves::Move, player::Player};
+use crate::{board::{Board, io::IO}, moves::Move};
use super::Grossmeister;
@@ -41,7 +41,7 @@ impl Grossmeister {
todo!()
}
"ucinewgame" => {
- todo!("What should we even do here?")
+ // TODO: clear transposition table
}
"position" => {
if let Some(token) = tokens.next() {
@@ -78,6 +78,18 @@ impl Grossmeister {
}
}
"go" => {
+ // Clone current self and move it
+ // into thread to analyze a position
+ let mut gm = self.clone();
+ let builder = Builder::new();
+
+ search_handle = Some(builder.spawn(move || {
+ gm.iterative_deepening(6);
+ gm
+ }).unwrap());
+
+ continue;
+
if let Some(token) = tokens.next() {
match token {
"searchmoves" => todo!(),
@@ -87,7 +99,22 @@ impl Grossmeister {
"winc" => todo!(),
"binc" => todo!(),
"movestogo" => todo!(),
- "depth" => todo!(),
+ "depth" => {
+ if let Some(depth) = tokens.next() {
+ let depth: u8 = depth.parse().unwrap();
+
+ // Clone current self and move it
+ // into thread to analyze a position
+ let mut gm = self.clone();
+ let builder = Builder::new();
+
+
+ search_handle = Some(builder.spawn(move || {
+ gm.iterative_deepening(depth);
+ gm
+ }).unwrap());
+ }
+ },
"nodes" => todo!(),
"mate" => todo!(),
"movetime" => todo!(),
@@ -98,7 +125,7 @@ impl Grossmeister {
let builder = Builder::new();
search_handle = Some(builder.spawn(move || {
- gm.analyze(gm.board);
+ gm.iterative_deepening(u8::MAX);
gm
}).unwrap());
},