From 39b48ab81c40c33d4e79a6aba025bee7b4e82f7b Mon Sep 17 00:00:00 2001 From: eboatwright <64672325+eboatwright@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:39:10 -0600 Subject: [PATCH 1/4] Updated README --- Cargo.toml | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 00ea054..2c96e3e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "maxwell" -version = "3.0.8" +version = "3.0.9" edition = "2021" [dependencies] diff --git a/README.md b/README.md index 19f3d26..f984c9b 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ - This value is then also clamped between 0.25 and 20.0 seconds - Exits search if a mate is found within search depth - Alpha beta pruning - - Quiescence search + - Quiescence search with Delta Pruning - Transposition table - No set max size, but entries get removed after 10 moves without hits - Null move pruning @@ -60,4 +60,4 @@ - [The Chess Programming Wiki](https://www.chessprogramming.org/Main_Page) - [BBC Engine Development](https://www.youtube.com/playlist?list=PLmN0neTso3Jxh8ZIylk74JpwfiWNI76Cs) - [Lynx](https://github.com/lynx-chess/Lynx/) - - [Weiawaga](https://github.com/Heiaha/Weiawaga/) + - [Weiawaga](https://github.com/Heiaha/Weiawaga/) \ No newline at end of file From 08a5d53800b2522f774f4feed46fe45b683bcf06 Mon Sep 17 00:00:00 2001 From: eboatwright <64672325+eboatwright@users.noreply.github.com> Date: Sat, 6 Jan 2024 09:00:06 -0600 Subject: [PATCH 2/4] 1/6/24 9:00 AM Added support for "go depth" commands Added id name and author output on "uci" command Engine now prints out how many seconds the search took --- icon/Maxwell_100x100.png | Bin 0 -> 10647 bytes src/bot.rs | 29 +++++++++++++---------- src/main.rs | 48 ++++++++++++++++++++++++--------------- 3 files changed, 47 insertions(+), 30 deletions(-) create mode 100644 icon/Maxwell_100x100.png diff --git a/icon/Maxwell_100x100.png b/icon/Maxwell_100x100.png new file mode 100644 index 0000000000000000000000000000000000000000..a5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kCym+FJ|5n~nPj3W_1)-ry)*_%1 z0Xk_0ns$UH-MIb1l1Rf^XtCId_uO@vFlMm-UJ5l9wkZ55hEq<{Z$$GsVI)#|yb{PP)!>OqAW| zhqM3(izZGmRT5j#m5NOp?}q`%2x;*$p_l>z z(@Zq$kvcHvdPmMo6~Dg6b6?0PK5)M=SPh|JVxSXyp|!+0JKG~ zTew?a>=58m+zXjuP)32&eYBm9YY5JrE!RF-jKX>-rfwmX#AvS&(TeT^(N$0BouFkW zCl9*}j7sc_ABxQ}QBi@W9O798p7n_Lo+@Nd9m!>0m~frb2{;eqke0Fc?zK9fd{n7j zt=XuhMH(7X5s{JrB_fox$XXI@w^OdH-AN!G1|Z`k#+hQzi^OJ_C=Z~>peaSPM}cQt zqM66?*`tTE{xg%Fdn%)NA8oMT;&u)#Qm=;5)$5Jsg>#MOQY5xxAWaKY09g}3i3qD& zq@0q7Xvlk#-JC2u0$_MnW!zAV7m3X%qC9~L3`{X-3Pe*3n%eKWvnL9M|D`=A1*6 zVL}}66DcDSM%Ff3+LS9{xO%(YF5L*jmW}rq2of5+DL|FtSDA>aQJhR_rHu7M1L9Ev zGV0pBsQ-YISAl3pi*>bF-#{`p?zJyiNS=U#0J(T2=y)Yh#41ezP?G#sQZZ=-h$voS xB%oOJv?#U*btbAsV(SSAogw%2p#sr8{x4Pl3t|^(r5OMK002ovPDHLkV1kX@@b3Ts literal 0 HcmV?d00001 diff --git a/src/bot.rs b/src/bot.rs index 0058451..ba51174 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -112,7 +112,7 @@ impl Bot { } } - pub fn start(&mut self, board: &mut Board, moves: String, my_time: f32) { + pub fn start(&mut self, board: &mut Board, moves: String, my_time: f32, depth_to_search: u8) { if self.in_opening_book { let opening_move = self.opening_book.get_opening_move(moves); if opening_move == NULL_MOVE { @@ -123,18 +123,21 @@ impl Bot { } } - self.time_to_think = if self.config.time_management { - let time_percentage = if board.moves.len() / 2 <= 6 { - PERCENT_OF_TIME_TO_USE_BEFORE_6_FULL_MOVES + self.time_to_think = + if my_time == 0.0 { // This means we're in a "go depth X" command + 0.0 + } else if self.config.time_management { + let time_percentage = if board.moves.len() / 2 <= 6 { + PERCENT_OF_TIME_TO_USE_BEFORE_6_FULL_MOVES + } else { + PERCENT_OF_TIME_TO_USE_AFTER_6_FULL_MOVES + }; + + (my_time * time_percentage).clamp(MIN_TIME_PER_MOVE, MAX_TIME_PER_MOVE) } else { - PERCENT_OF_TIME_TO_USE_AFTER_6_FULL_MOVES + my_time }; - (my_time * time_percentage).clamp(MIN_TIME_PER_MOVE, MAX_TIME_PER_MOVE) - } else { - my_time - }; - self.search_cancelled = false; let last_evaluation = self.evaluation; @@ -151,7 +154,7 @@ impl Bot { let mut window = 40; self.think_timer = Instant::now(); - for depth in 1..=(255 - MAX_SEARCH_EXTENSIONS) { + for depth in 1..=depth_to_search { self.searched_one_move = false; self.best_move_this_iteration = NULL_MOVE; self.evaluation_this_iteration = 0; @@ -201,6 +204,8 @@ impl Bot { } } + self.println(format!("{} seconds", self.think_timer.elapsed().as_secs_f32())); + self.transposition_table.update(); if self.config.debug_output { self.transposition_table.print_size(); @@ -208,7 +213,7 @@ impl Bot { } fn should_cancel_search(&mut self) -> bool { - self.search_cancelled = self.search_cancelled || self.think_timer.elapsed().as_secs_f32() >= self.time_to_think; + self.search_cancelled = (self.search_cancelled || self.think_timer.elapsed().as_secs_f32() >= self.time_to_think) && self.time_to_think > 0.0; self.search_cancelled } diff --git a/src/main.rs b/src/main.rs index 66ff87e..6a2d7e2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,11 +16,9 @@ https://www.chessprogramming.org/Futility_Pruning#MoveCountBasedPruning https://www.chessprogramming.org/Triangular_PV-Table https://www.chessprogramming.org/Static_Exchange_Evaluation -Some random resources I found: -https://analog-hors.github.io/site/magic-bitboards/ (didn't use this for my initial implementation, but that might change ;)) +Some random resources I found: (Not using them right now but they could be useful) +https://analog-hors.github.io/site/magic-bitboards/ https://web.archive.org/web/20071030220825/http://www.brucemo.com/compchess/programming/pvs.htm -https://github.com/lynx-chess/Lynx/ -https://github.com/Heiaha/Weiawaga/ */ #![allow(dead_code)] @@ -47,7 +45,7 @@ mod bot; mod move_sorter; use crate::castling_rights::print_castling_rights; -use crate::bot::{Bot, BotConfig}; +use crate::bot::{Bot, BotConfig, MAX_SEARCH_EXTENSIONS}; use crate::perft::*; use crate::move_data::MoveData; use crate::pieces::*; @@ -93,7 +91,13 @@ fn main() { match command_split[0] { // UCI protocol - "uci" => println!("uciok"), + "uci" => { + println!("id name Maxwell"); + println!("id author eboatwright"); + + println!("uciok"); + } + "isready" => println!("readyok"), "ucinewgame" => { @@ -121,10 +125,13 @@ fn main() { moves.pop(); } - // Format: go (movetime, wtime) X (btime Y) + // Format: + // go (movetime, wtime) X (btime Y) + // go depth X "go" => { let my_time_label = if board.white_to_move { "wtime" } else { "btime" }; let mut my_time = 0.0; + let mut depth_to_search = 255 - MAX_SEARCH_EXTENSIONS; for i in [1, 3] { if command_split[i] == my_time_label @@ -133,10 +140,15 @@ fn main() { my_time = time_in_millis as f32 / 1000.0; break; } + } else if command_split[i] == "depth" { + if let Ok(_depth_to_search) = command_split[i + 1].parse::() { + depth_to_search = _depth_to_search; + break; + } } } - bot.start(&mut board, moves.clone(), my_time); + bot.start(&mut board, moves.clone(), my_time, depth_to_search); println!("bestmove {}", bot.best_move.to_coordinates()); // log.write(format!("bestmove {}", bot.best_move.to_coordinates())); @@ -145,7 +157,7 @@ fn main() { "stop" => bot.search_cancelled = true, "quit" => break, - // My debug tools :] + // My debug tools // "play" => play(command_split[1] == "white"), @@ -162,15 +174,15 @@ fn main() { } } - "clearlogs" => { - if let Ok(logs_folder) = std::fs::read_dir("./logs/") { - for log_file in logs_folder { - std::fs::remove_file(log_file.unwrap().path()).expect("Failed to clear logs"); - } - } else { - println!("No logs folder"); - } - } + // "clearlogs" => { + // if let Ok(logs_folder) = std::fs::read_dir("./logs/") { + // for log_file in logs_folder { + // std::fs::remove_file(log_file.unwrap().path()).expect("Failed to clear logs"); + // } + // } else { + // println!("No logs folder"); + // } + // } "print" => board.print(), "bitboards" => board.print_bitboards(), From 4eee5369af5c8d443c25a5fe6d309bae7282c507 Mon Sep 17 00:00:00 2001 From: eboatwright <64672325+eboatwright@users.noreply.github.com> Date: Sat, 6 Jan 2024 09:28:16 -0600 Subject: [PATCH 3/4] 1/6/24 9:28 AM --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 2c96e3e..00ea054 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "maxwell" -version = "3.0.9" +version = "3.0.8" edition = "2021" [dependencies] From 065959d59988f5118e815d0a722c38a16b40c038 Mon Sep 17 00:00:00 2001 From: eboatwright <64672325+eboatwright@users.noreply.github.com> Date: Sat, 6 Jan 2024 09:32:23 -0600 Subject: [PATCH 4/4] 1/6/24 9:32 AM --- README.md | 2 +- src/main.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f984c9b..c4f4bd8 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ - opening_book=\: Toggle opening book (default=true) - time_management=\: Toggle time management, if false the bot will use all the remaining time (default=true) #### UCI Interface - - Only supports games from startpos - uci, isready, ucinewgame, position, go, stop, and quit commands + - "position" is only implemented for "position startpos", "position fen" is not yet implemented #### Board Representation - Purely bitboards - Supports loading from FEN strings diff --git a/src/main.rs b/src/main.rs index 6a2d7e2..b54a4b3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -92,7 +92,7 @@ fn main() { // UCI protocol "uci" => { - println!("id name Maxwell"); + println!("id name Maxwell v3.0.8-1"); println!("id author eboatwright"); println!("uciok");