From f07f976b62b9c6957c49858eeb25f39c7cb0431d Mon Sep 17 00:00:00 2001 From: James Tan Date: Wed, 9 Mar 2022 01:32:06 -0500 Subject: [PATCH] Update README.md and add help text for CLI args --- README.md | 14 +++++++++++--- src/main.rs | 19 ++++++++++++++++--- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d642d4a..e415233 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,20 @@ # requin -A chess program that runs in the CLI. Current plans include coding up all the rules of the game and then building an AI that plays it. - +A chess program that runs in the CLI. It also comes with a chess engine (that is currently not too strong). ## Design ### Generation of Legal Moves All possible piece displacements are first generated, then to check if a certain move is legal (i.e. whether it would endanger the king) we try applying the move to the board and if the king is not capturable then the move can be considered legal. - ### Checks After applying a move to the board, we check if the player that just moved has a move that captures the enemy king, if so then the last move checks the enemy king. + +### Search +The engine employs a simple evaluation function that takes into account the raw value of pieces and their positional values. To evaluate the principal variation, the engine uses minimax with alpha-beta pruning. + +## How to run? +You have to first install [cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html) (the Rust package manager). Then, you can compile the program by running + +```bash +cargo build --release +``` \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 5cc9410..7f11ccf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,13 +3,26 @@ use requin::{play_game_ai, play_game_pvp}; use structopt::StructOpt; #[derive(StructOpt, Debug)] -#[structopt(name = "requin", about = "A CLI chess program with a chess engine.")] +#[structopt( + name = "requin", + about = "A CLI chess program with a chess engine.", + version = "1.0.1" +)] struct Opt { - #[structopt(short, long, default_value = "ai")] + #[structopt( + short, + long, + default_value = "ai", + help = "Available game modes: 'ai' or 'pvp'" + )] mode: String, #[structopt(short, long, default_value = "5")] depth: u32, - #[structopt(long, default_value = "4")] + #[structopt( + long, + default_value = "4", + help = "Number of threads to use during move searches" + )] num_threads: usize, }