aboutsummaryrefslogtreecommitdiff
path: root/src/grossmeister/UCI.rs
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-02-26 21:08:37 +0300
committereug-vs <eugene@eug-vs.xyz>2023-02-26 21:08:37 +0300
commit6a92408ef0209e48c2a09ab3c7c33d0e5a8dddce (patch)
tree18f067486c30fe0251468b98f5f0d0b76c7206d8 /src/grossmeister/UCI.rs
parentfe952d63dc26c787350c9b3259d037344241665b (diff)
downloadchessnost-6a92408ef0209e48c2a09ab3c7c33d0e5a8dddce.tar.gz
feat: finish very basic UCI implementation
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());
},