Skip to content

Commit

Permalink
Update README.md and add help text for CLI args
Browse files Browse the repository at this point in the history
  • Loading branch information
jamestjw committed Mar 9, 2022
1 parent 0e4b4dd commit f07f976
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
```
19 changes: 16 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down

0 comments on commit f07f976

Please sign in to comment.