diff --git a/Cargo.toml b/Cargo.toml index 4cb9c4c..b2e79ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,14 +3,16 @@ members = ["crates/*"] resolver = "2" [workspace.dependencies] -hash-bootstrap = { path = "crates/hash-bootstrap" } -hash-core = { path = "crates/hash-core" } -hash-engine = { path = "crates/hash-engine" } -hash-network = { path = "crates/hash-network" } -hash-search = { path = "crates/hash-search" } -hash-train = { path = "crates/hash-train" } -hash-server = { path = "crates/hash-server" } -hash-client = { path = "crates/hash-client" } +mangrove-bootstrap = { path = "crates/mangrove-bootstrap" } +mangrove-core = { path = "crates/mangrove-core" } +mangrove-engine = { path = "crates/mangrove-engine" } +mangrove-pisa = { path = "crates/mangrove-pisa" } +mangrove-search = { path = "crates/mangrove-search" } +mangrove-train = { path = "crates/mangrove-train" } + +swamp-server = { path = "crates/swamp-server" } +swamp-client = { path = "crates/swamp-client" } + rustifact = "0.10.1" burn = "0.11.1" burn-wgpu = "0.11.1" diff --git a/README.md b/README.md index ca2c2fe..820ac71 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,21 @@ -# The Hash Chess Engine +# The Mangrove Chess Engine [![Status](https://github.com/miestrode/hash/workflows/Rust/badge.svg)](https://github.com/miestrode/hash/actions) -Hash is a CEGO (revision 1) compliant experimental Chess engine written in Rust, with the goal of putting to use recent advancements in statistics, computer science and computer Chess. Unlike most traditional Chess engines, Hash doesn't use the alpha-beta framework, and instead opts to perform directed tree search in the form of AlphaZero-style MCTS, while in the future, incorporating and facilitating new ideas and innovations in Computer Chess, neural network architecture, and directed tree search. +Mangrove is a CEGO (revision 1) compliant experimental Chess engine written in Rust, with the goal of putting to use recent advancements in statistics, computer science and computer Chess. Unlike most traditional Chess engines, Mangrove doesn't use the alpha-beta framework, and instead opts to perform directed tree search in the form of AlphaZero-style MCTS, while in the future, incorporating and facilitating new ideas and innovations in Computer Chess, neural network architecture, and directed tree search. -A secondary goal of Hash is to use as much Rust as possible in its design, to test the boundaries of what is possible to do with modern Rust. Therefore, Hash currently uses the Burn deep learning framework for running its neural networks, instead of more established options, such as Tensorflow or PyTorch. The hope is that, in the future, there will be less of a feature gap between the frameworks, and that optimization tools will grow to support Burn and similar Rust-based projects. +A secondary goal of Mangrove is to use as much Rust as possible in its design, to test the boundaries of what is possible to do with modern Rust. Therefore, Mangrove currently uses the Burn deep learning framework for running its neural networks, instead of more established options, such as Tensorflow or PyTorch. The hope is that, in the future, there will be less of a feature gap between the frameworks, and that optimization tools will grow to support Burn and similar Rust-based projects. -Hash is currently in the process of being written, and has not officially released in any form. It is unlikely the code in the repository here currently works as a full Chess engine. +Mangrove is currently in the process of being written, and has not officially released in any form. It is unlikely the code in the repository here currently works as a full Chess engine. -## CEGO (or, why Hash doesn't support UCI) +## CEGO (or, why Mangrove doesn't support UCI) -Hash doesn't support UCI, and instead uses its bespoke protocol, CEGO (Chess Engine Game Operation). The reasons for this are partially explained in [here](docs/cego/REVISION-1.md). It suffices to say, we felt UCI and similar protocols weren't good choices given the use cases for this engine. +Mangrove doesn't support UCI, and instead uses its bespoke protocol, CEGO (Chess Engine Game Operation). The reasons for this are partially explained in [here](docs/cego/REVISION-1.md). It suffices to say, we felt UCI and similar protocols weren't good choices given the use cases for this engine. ## Documentation -As we feel Hash is a sufficiently large project, documentation explaining things such as its current network structure and things of the like can be seen in [here](docs/). Note that documentation is currently largely incomplete. +As we feel Mangrove is a sufficiently large project, documentation explaining things such as its current network structure and things of the like can be seen in [here](docs/). Note that documentation is currently largely incomplete. ## Contributing -The project currently will not accept contributions which significantly alter the source code, and so does not have guidelines for doing so. This is because things are currently far too underdeveloped. In the future, a `CONTRIBUTING.md` file will be made. +Mangrove currently isn't accept contributions which significantly alter the source code, and so does not have guidelines for doing so. This is because things are currently far too underdeveloped. In the future, a `CONTRIBUTING.md` file will be made. diff --git a/crates/hash-bootstrap/Cargo.toml b/crates/mangrove-bootstrap/Cargo.toml similarity index 80% rename from crates/hash-bootstrap/Cargo.toml rename to crates/mangrove-bootstrap/Cargo.toml index ff0f7d4..adae482 100644 --- a/crates/hash-bootstrap/Cargo.toml +++ b/crates/mangrove-bootstrap/Cargo.toml @@ -1,6 +1,5 @@ [package] -name = "hash-bootstrap" -authors = ["Yoav Grimland "] +name = "mangrove-bootstrap" version = "0.0.0" edition.workspace = true diff --git a/crates/hash-bootstrap/src/bitboard.rs b/crates/mangrove-bootstrap/src/bitboard.rs similarity index 100% rename from crates/hash-bootstrap/src/bitboard.rs rename to crates/mangrove-bootstrap/src/bitboard.rs diff --git a/crates/hash-bootstrap/src/lib.rs b/crates/mangrove-bootstrap/src/lib.rs similarity index 100% rename from crates/hash-bootstrap/src/lib.rs rename to crates/mangrove-bootstrap/src/lib.rs diff --git a/crates/hash-bootstrap/src/metadata.rs b/crates/mangrove-bootstrap/src/metadata.rs similarity index 100% rename from crates/hash-bootstrap/src/metadata.rs rename to crates/mangrove-bootstrap/src/metadata.rs diff --git a/crates/hash-bootstrap/src/square.rs b/crates/mangrove-bootstrap/src/square.rs similarity index 100% rename from crates/hash-bootstrap/src/square.rs rename to crates/mangrove-bootstrap/src/square.rs diff --git a/crates/hash-bootstrap/src/zobrist_map.rs b/crates/mangrove-bootstrap/src/zobrist_map.rs similarity index 100% rename from crates/hash-bootstrap/src/zobrist_map.rs rename to crates/mangrove-bootstrap/src/zobrist_map.rs diff --git a/crates/hash-core/Cargo.toml b/crates/mangrove-core/Cargo.toml similarity index 73% rename from crates/hash-core/Cargo.toml rename to crates/mangrove-core/Cargo.toml index 673a7fa..2281b44 100644 --- a/crates/hash-core/Cargo.toml +++ b/crates/mangrove-core/Cargo.toml @@ -1,13 +1,12 @@ [package] -name = "hash-core" -authors = ["Yoav Grimland "] +name = "mangrove-core" version = "0.0.0" edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [build-dependencies] -hash-bootstrap.workspace = true +mangrove-bootstrap.workspace = true rustifact.workspace = true rand.workspace = true @@ -15,7 +14,7 @@ rand.workspace = true test-case.workspace = true [dependencies] -hash-bootstrap.workspace = true +mangrove-bootstrap.workspace = true rustifact.workspace = true arrayvec.workspace = true thiserror.workspace = true diff --git a/crates/hash-core/build.rs b/crates/mangrove-core/build.rs similarity index 99% rename from crates/hash-core/build.rs rename to crates/mangrove-core/build.rs index 152bf61..df5f8a8 100644 --- a/crates/hash-core/build.rs +++ b/crates/mangrove-core/build.rs @@ -2,7 +2,7 @@ use std::{array, io::Error}; use rand::{rngs::StdRng, Rng, SeedableRng}; -use hash_bootstrap::{BitBoard, Color, Metadata, Square, ZobristMap}; +use mangrove_bootstrap::{BitBoard, Color, Metadata, Square, ZobristMap}; use rustifact::ToTokenStream; const SEED: u64 = 0x73130172E6DEA605; diff --git a/crates/hash-core/src/board.rs b/crates/mangrove-core/src/board.rs similarity index 99% rename from crates/hash-core/src/board.rs rename to crates/mangrove-core/src/board.rs index b357b54..77eb2f5 100644 --- a/crates/hash-core/src/board.rs +++ b/crates/mangrove-core/src/board.rs @@ -12,7 +12,7 @@ use crate::{ mg, repr::{ChessMove, ParsePieceBoardError, Piece, PieceBoard, PieceKind, PieceKindBoard, Player}, }; -use hash_bootstrap::{BitBoard, Color, ParseSquareError, Square}; +use mangrove_bootstrap::{BitBoard, Color, ParseSquareError, Square}; #[derive(Clone, Copy, Debug, PartialEq)] pub struct Board { diff --git a/crates/hash-core/src/game.rs b/crates/mangrove-core/src/game.rs similarity index 97% rename from crates/hash-core/src/game.rs rename to crates/mangrove-core/src/game.rs index 36d2267..084ca19 100644 --- a/crates/hash-core/src/game.rs +++ b/crates/mangrove-core/src/game.rs @@ -1,6 +1,6 @@ use std::str::FromStr; -use hash_bootstrap::Color; +use mangrove_bootstrap::Color; use crate::{ board::{Board, MakeMoveError, ParseBoardError}, diff --git a/crates/hash-core/src/index.rs b/crates/mangrove-core/src/index.rs similarity index 99% rename from crates/hash-core/src/index.rs rename to crates/mangrove-core/src/index.rs index db294d0..3410925 100644 --- a/crates/hash-core/src/index.rs +++ b/crates/mangrove-core/src/index.rs @@ -1,4 +1,4 @@ -use hash_bootstrap::{ +use mangrove_bootstrap::{ BitBoard, Color, Metadata, Square, ZobristCastlingRights, ZobristMap, ZobristPieces, ZobristSide, }; @@ -254,7 +254,7 @@ pub fn line_between(a: Square, b: Square) -> BitBoard { /// let combined_hash = white_king_rook ^ side_to_play; /// ``` pub mod zobrist { - use hash_bootstrap::{Color, Square}; + use mangrove_bootstrap::{Color, Square}; use crate::repr::{CastlingRights, Piece, PieceBoard, PieceKind}; diff --git a/crates/hash-core/src/lib.rs b/crates/mangrove-core/src/lib.rs similarity index 100% rename from crates/hash-core/src/lib.rs rename to crates/mangrove-core/src/lib.rs diff --git a/crates/hash-core/src/mg.rs b/crates/mangrove-core/src/mg.rs similarity index 99% rename from crates/hash-core/src/mg.rs rename to crates/mangrove-core/src/mg.rs index 8c4b3c6..cdb46ec 100644 --- a/crates/hash-core/src/mg.rs +++ b/crates/mangrove-core/src/mg.rs @@ -1,5 +1,5 @@ use arrayvec::ArrayVec; -use hash_bootstrap::{BitBoard, Color, Square}; +use mangrove_bootstrap::{BitBoard, Color, Square}; use crate::{ board::Board, diff --git a/crates/hash-core/src/repr.rs b/crates/mangrove-core/src/repr.rs similarity index 99% rename from crates/hash-core/src/repr.rs rename to crates/mangrove-core/src/repr.rs index 28344ce..487f419 100644 --- a/crates/hash-core/src/repr.rs +++ b/crates/mangrove-core/src/repr.rs @@ -1,4 +1,4 @@ -use hash_bootstrap::{BitBoard, Color, ParseSquareError, Square}; +use mangrove_bootstrap::{BitBoard, Color, ParseSquareError, Square}; use std::{ fmt::{self, Display}, ops::{Index, IndexMut}, diff --git a/crates/hash-network/Cargo.toml b/crates/mangrove-pisa/Cargo.toml similarity index 64% rename from crates/hash-network/Cargo.toml rename to crates/mangrove-pisa/Cargo.toml index 306b74a..c5ac646 100644 --- a/crates/hash-network/Cargo.toml +++ b/crates/mangrove-pisa/Cargo.toml @@ -1,14 +1,13 @@ [package] -name = "hash-network" -authors = ["Yoav Grimland "] +name = "mangrove-pisa" version = "0.0.0" edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -hash-bootstrap.workspace = true -hash-core.workspace = true +mangrove-bootstrap.workspace = true +mangrove-core.workspace = true burn.workspace = true serde.workspace = true diff --git a/crates/hash-network/src/lib.rs b/crates/mangrove-pisa/src/lib.rs similarity index 95% rename from crates/hash-network/src/lib.rs rename to crates/mangrove-pisa/src/lib.rs index 58aaae2..2f8a2a3 100644 --- a/crates/hash-network/src/lib.rs +++ b/crates/mangrove-pisa/src/lib.rs @@ -1,8 +1,10 @@ use burn::tensor::{backend::Backend, Shape, Tensor}; -use hash_bootstrap::{BitBoard, Color, Square}; -use hash_core::{board::Board, repr::Player}; +use mangrove_bootstrap::{BitBoard, Color, Square}; +use mangrove_core::{board::Board, repr::Player}; -pub mod model; +mod model; + +pub use model::*; fn bitboard_to_tensor(bitboard: BitBoard) -> Tensor { Tensor::from_floats((Square::ALL).map(|square| f32::from(bitboard.get_bit(square)))) diff --git a/crates/hash-network/src/model.rs b/crates/mangrove-pisa/src/model.rs similarity index 95% rename from crates/hash-network/src/model.rs rename to crates/mangrove-pisa/src/model.rs index 3db5199..0440b8b 100644 --- a/crates/hash-network/src/model.rs +++ b/crates/mangrove-pisa/src/model.rs @@ -8,8 +8,8 @@ use burn::{ }, tensor::{activation, backend::Backend, Shape, Tensor}, }; -use hash_bootstrap::Square; -use hash_core::{ +use mangrove_bootstrap::Square; +use mangrove_core::{ board::Board, repr::{ChessMove, PieceKind}, }; @@ -205,13 +205,13 @@ impl IndexMut for MoveProbabilities { } } -pub struct H0Result { +pub struct PisaResult { pub value: f32, pub move_probabilities: MoveProbabilities, } -impl From for Tensor { - fn from(value: H0Result) -> Self { +impl From for Tensor { + fn from(value: PisaResult) -> Self { Tensor::cat( vec![ Tensor::from_floats(value.move_probabilities.probabilities), @@ -228,7 +228,7 @@ pub struct BatchOutput { } #[derive(Module, Debug)] -pub struct H0 { +pub struct Pisa { move_history: usize, conv_block: Conv2d, se_blocks: Vec>, @@ -236,7 +236,7 @@ pub struct H0 { output: Linear, } -impl H0 { +impl Pisa { pub fn move_history(&self) -> usize { self.move_history } @@ -260,7 +260,7 @@ impl H0 { } } - pub fn process(&self, input: Vec<&[Board]>) -> Vec { + pub fn process(&self, input: Vec<&[Board]>) -> Vec { let batch_output = self.forward(Tensor::stack( input .iter() @@ -285,7 +285,7 @@ impl H0 { values .into_iter() .zip(probabilities) - .map(|(value, move_probabilities)| H0Result { + .map(|(value, move_probabilities)| PisaResult { value, move_probabilities, }) @@ -294,7 +294,7 @@ impl H0 { } #[derive(Config, Debug)] -pub struct H0Config { +pub struct PisaConfig { #[config(default = 1)] initial_kernel_stride: usize, #[config(default = 3)] @@ -313,9 +313,9 @@ pub struct H0Config { ratio: usize, } -impl H0Config { - pub fn init(&self) -> H0 { - H0 { +impl PisaConfig { + pub fn init(&self) -> Pisa { + Pisa { move_history: self.move_history, conv_block: Conv2dConfig::new( [ diff --git a/crates/hash-search/Cargo.toml b/crates/mangrove-search/Cargo.toml similarity index 71% rename from crates/hash-search/Cargo.toml rename to crates/mangrove-search/Cargo.toml index 32be1d1..4479f65 100644 --- a/crates/hash-search/Cargo.toml +++ b/crates/mangrove-search/Cargo.toml @@ -1,14 +1,13 @@ [package] -name = "hash-search" -authors = ["Yoav Grimland "] +name = "mangrove-search" version = "0.0.0" edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -hash-core.workspace = true -hash-network.workspace = true +mangrove-core.workspace = true +mangrove-pisa.workspace = true burn.workspace = true thiserror.workspace = true tracing.workspace = true diff --git a/crates/hash-search/src/lib.rs b/crates/mangrove-search/src/lib.rs similarity index 100% rename from crates/hash-search/src/lib.rs rename to crates/mangrove-search/src/lib.rs diff --git a/crates/hash-search/src/puct.rs b/crates/mangrove-search/src/puct.rs similarity index 100% rename from crates/hash-search/src/puct.rs rename to crates/mangrove-search/src/puct.rs diff --git a/crates/hash-search/src/search.rs b/crates/mangrove-search/src/search.rs similarity index 95% rename from crates/hash-search/src/search.rs rename to crates/mangrove-search/src/search.rs index f1719c2..538bbd6 100644 --- a/crates/hash-search/src/search.rs +++ b/crates/mangrove-search/src/search.rs @@ -1,7 +1,7 @@ use crate::tree::Tree; use burn::tensor::backend::Backend; -use hash_core::repr::ChessMove; -use hash_network::model::H0; +use mangrove_core::repr::ChessMove; +use mangrove_pisa::Pisa; use std::{ sync::mpsc::{self, Receiver, Sender, TryRecvError}, @@ -15,7 +15,7 @@ pub enum SearchCommand { pub fn start_search_thread( mut tree: Tree, - network: H0, + network: Pisa, exploration_rate: f32, ) -> (Sender, Receiver) { let (command_sender, command_receiver) = mpsc::channel(); diff --git a/crates/hash-search/src/tree.rs b/crates/mangrove-search/src/tree.rs similarity index 97% rename from crates/hash-search/src/tree.rs rename to crates/mangrove-search/src/tree.rs index 5c8e15d..4a9ae93 100644 --- a/crates/hash-search/src/tree.rs +++ b/crates/mangrove-search/src/tree.rs @@ -4,8 +4,8 @@ use std::{ }; use burn::tensor::backend::Backend; -use hash_core::{board::Board, mg, repr::ChessMove}; -use hash_network::model::H0; +use mangrove_core::{board::Board, mg, repr::ChessMove}; +use mangrove_pisa::Pisa; use ringbuffer::{AllocRingBuffer, RingBuffer}; use crate::puct; @@ -200,7 +200,7 @@ impl Tree { } } - pub fn grow(&self, network: &H0, exploration_rate: f32) { + pub fn grow(&self, network: &Pisa, exploration_rate: f32) { let (path, boards) = self.select(exploration_rate, network.move_history()); let end_board = boards.last().unwrap(); let network_result = &network.process(vec![&boards[..]])[0]; diff --git a/crates/hash-train/Cargo.toml b/crates/mangrove-train/Cargo.toml similarity index 65% rename from crates/hash-train/Cargo.toml rename to crates/mangrove-train/Cargo.toml index 226dd57..c8ffe1e 100644 --- a/crates/hash-train/Cargo.toml +++ b/crates/mangrove-train/Cargo.toml @@ -1,15 +1,14 @@ [package] -name = "hash-train" -authors = ["Yoav Grimland "] +name = "mangrove-train" version = "0.0.0" edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -hash-core.workspace = true -hash-search.workspace = true -hash-network.workspace = true +mangrove-core.workspace = true +mangrove-search.workspace = true +mangrove-pisa.workspace = true burn = { workspace = true, features = ["autodiff"] } ringbuffer.workspace = true rand.workspace = true diff --git a/crates/hash-train/src/lib.rs b/crates/mangrove-train/src/lib.rs similarity index 100% rename from crates/hash-train/src/lib.rs rename to crates/mangrove-train/src/lib.rs diff --git a/crates/hash-train/src/main.rs b/crates/mangrove-train/src/main.rs similarity index 100% rename from crates/hash-train/src/main.rs rename to crates/mangrove-train/src/main.rs diff --git a/crates/hash-train/src/play.rs b/crates/mangrove-train/src/play.rs similarity index 94% rename from crates/hash-train/src/play.rs rename to crates/mangrove-train/src/play.rs index 0f0d737..129734f 100644 --- a/crates/hash-train/src/play.rs +++ b/crates/mangrove-train/src/play.rs @@ -2,15 +2,12 @@ use std::iter; use burn::tensor::{backend::Backend, Tensor}; -use hash_core::{ +use mangrove_core::{ board::Board, game::{Game, Outcome}, }; -use hash_network::model::{H0Result, MoveProbabilities, H0}; -use hash_search::{ - puct::PuctSelector, - tree::{Selector, Tree}, -}; +use mangrove_pisa::model::{MoveProbabilities, Pisa, PisaResult}; +use mangrove_search::tree::Tree; use rand::{distributions::WeightedIndex, Rng}; use ringbuffer::{AllocRingBuffer, RingBuffer}; @@ -103,7 +100,7 @@ pub fn gen_game( .chain(iter::repeat(None).take(model.move_history() - boards.len())) .collect(), ), - expected_output: H0Result { + expected_output: PisaResult { // If the finshing color, in other words, the color that would play if the game // wasn't finished, actually won, it would mean it would have the ability to // capture the opponent's king, and thus this color always loses. diff --git a/crates/hash-train/src/train.rs b/crates/mangrove-train/src/train.rs similarity index 100% rename from crates/hash-train/src/train.rs rename to crates/mangrove-train/src/train.rs diff --git a/crates/hash-engine/Cargo.toml b/crates/mangrove/Cargo.toml similarity index 70% rename from crates/hash-engine/Cargo.toml rename to crates/mangrove/Cargo.toml index a85990b..e480e3d 100644 --- a/crates/hash-engine/Cargo.toml +++ b/crates/mangrove/Cargo.toml @@ -1,8 +1,6 @@ [package] -name = "hash-engine" -description = "The Hash Chess Engine CLI" +name = "mangrove" version = "0.0.0" -authors = ["Yoav Grimland "] edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -14,9 +12,9 @@ clap = { workspace = true, features = [ "color", "unstable-styles", ] } -hash-core.workspace = true -hash-search.workspace = true -hash-network.workspace = true +mangrove-core.workspace = true +mangrove-search.workspace = true +mangrove-pisa.workspace = true thiserror.workspace = true burn-wgpu.workspace = true tracing.workspace = true diff --git a/crates/hash-engine/src/engine.rs b/crates/mangrove/src/engine.rs similarity index 98% rename from crates/hash-engine/src/engine.rs rename to crates/mangrove/src/engine.rs index dc32b9f..1ecbcaf 100644 --- a/crates/hash-engine/src/engine.rs +++ b/crates/mangrove/src/engine.rs @@ -13,12 +13,12 @@ use std::{ }; use burn_wgpu::Wgpu; -use hash_core::{ +use mangrove_core::{ board::{Board, ParseBoardError}, repr::{ChessMove, ParseChessMoveError}, }; -use hash_network::model::H0Config; -use hash_search::{ +use mangrove_pisa::PisaConfig; +use mangrove_search::{ search::{self, SearchCommand}, tree::Tree, }; @@ -203,7 +203,7 @@ impl<'a> Engine<'a> { engine_parameters: EngineParameters, mut message_reader: MessageReader<'a>, ) -> Result> { - let network = H0Config::new().init::(); + let network = PisaConfig::new().init::(); tracing::info!("initialized network"); Self::send_message(OutgoingMessage::Ready); diff --git a/crates/hash-engine/src/lib.rs b/crates/mangrove/src/lib.rs similarity index 99% rename from crates/hash-engine/src/lib.rs rename to crates/mangrove/src/lib.rs index 693f93f..893e908 100644 --- a/crates/hash-engine/src/lib.rs +++ b/crates/mangrove/src/lib.rs @@ -1,4 +1,5 @@ mod engine; + use std::{error::Error, fs::File, io, path::PathBuf}; use clap::{ diff --git a/crates/hash-engine/src/main.rs b/crates/mangrove/src/main.rs similarity index 100% rename from crates/hash-engine/src/main.rs rename to crates/mangrove/src/main.rs diff --git a/crates/hash-client/Cargo.toml b/crates/swamp-client/Cargo.toml similarity index 89% rename from crates/hash-client/Cargo.toml rename to crates/swamp-client/Cargo.toml index f35020a..491ece8 100644 --- a/crates/hash-client/Cargo.toml +++ b/crates/swamp-client/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "hash-client" +name = "swamp-client" version = "0.0.0" edition.workspace = true diff --git a/crates/hash-client/src/main.rs b/crates/swamp-client/src/main.rs similarity index 100% rename from crates/hash-client/src/main.rs rename to crates/swamp-client/src/main.rs diff --git a/crates/hash-server/Cargo.toml b/crates/swamp-server/Cargo.toml similarity index 89% rename from crates/hash-server/Cargo.toml rename to crates/swamp-server/Cargo.toml index ecccc0d..eb356a9 100644 --- a/crates/hash-server/Cargo.toml +++ b/crates/swamp-server/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "hash-server" +name = "swamp-server" version = "0.0.0" edition.workspace = true diff --git a/crates/hash-server/src/main.rs b/crates/swamp-server/src/main.rs similarity index 100% rename from crates/hash-server/src/main.rs rename to crates/swamp-server/src/main.rs diff --git a/docs/networks/CURRENT.md b/docs/networks/CURRENT.md deleted file mode 100644 index 3115494..0000000 --- a/docs/networks/CURRENT.md +++ /dev/null @@ -1,36 +0,0 @@ -# The H0 network architecture -The H0 network architecture is the current architecture used in the Hash Chess engine for search. It is a classic AlphaZero-style network, with a policy head, and a value head. Despite this, there are differences between it and the AlphaZero Chess network, in its body, input format, and output format. - -H0 isn't designed to be cutting edge or particularly good, but is rather designed so as to have a concrete net work as quickly as possible for Hash's first release, so that other parts of the engine will function. - -## Input -The logical input passed to the network is a representation of the 7 last game states, including the current one, where each game state is a 3D tensor, and the states are passed by concatenation, such that the current game state is last. A game state is encoded in the format below. Each enumerated item is an 8x8 float layer, and layers relating to squares on the board are encoded in Little Endian Rank-File (LERF), such that elements corresponding to highlighted squares on the tensor are given a value of `1.0`, and otherwise `0.0`: - -1. White pawns (bitboard) -2. White knights (bitboard) -3. White bishops (bitboard) -4. White rooks (bitboard) -5. White queens (bitboard) -6. White king (bitboard) -7. Black pawns (bitboard) -8. Black knights (bitboard) -9. Black bishops (bitboard) -10. Black rooks (bitboard) -11. Black queens (bitboard) -12. Black king (bitboard) -13. En passant capture square (bitboard) -14. Whether white can castle king-side (boolean) -15. Whether white can castle queen-side (boolean) -16. Whether black can castle king-side (boolean) -17. Whether black can castle queen-side (boolean) -18. Whether it is white's turn (boolean) -19. Half-move clock (numeric) -20. Is game state present (boolean) - -Layer 20 is used for cases where there do not exist 7 game states as described above. In this case, the whole tensor should simply be composed of zeros. - -## Body -The body of the network is composed of 15 convolutional blocks, and some fully connected layers. Each block consists of a convolution with a kernel of size 3x3, using 32 filters, then a batch normalization layer, and then a ReLU activation layer. After the blocks, the output from is passed to a fully connected layer, of output size 10000, which is passed to another fully connected layer, whose output is the final output of the body. - -## Output -