Pleco is a chess Engine & Library derived from Stockfish, written entirely in Rust

Overview

Pleco

Pleco is a chess Engine & Library derived from Stockfish, written entirely in Rust.

Pleco crate Pleco crate Build Status

This project is split into two crates, pleco, which contains the library functionality, and pleco_engine, which contains the UCI (Universal Chess Interface) compatible engine.

The overall goal for this project is to utilize the efficiency of Rust to create a Chess AI matching the speed of modern chess engines. For the engine, the majority of the code is a direct port of Stockfish's C++ code. See their website for more information about the engine. As such, the credit for all of the advanced algorithms used for searching, evaluation, and many others, go directly to the maintainers and authors of Stockfish. This project is for speed comparisons between the two languages, as well as for educational purposes.

Standalone Installation and Use

To use pleco as an executable, please navigate to here and read the README.md.

Using Pleco as a Library

To use pleco inside your own Rust projects, Pleco.rs is available as a library on crates.io. Simply include the current version in your Cargo.toml:

[dependencies]
pleco = "x.x.x"

And add the following to a main.rs or lib.rs:

extern crate pleco;

As of version 0.5.0, the pleco library is available on all three Rust channels (stable, beta, nightly).

Basic Usage

Setting up a board position is extremely simple.

use pleco::{Board,Player,PieceType};

let board = Board::start_pos();
assert_eq!(board.count_piece(Player::White,PieceType::P), 8);
assert_eq!(&board.fen(),"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1");

Creating a board from a Position

A Board can be created with any valid chess position using a valid FEN (Forsyth-Edwards Notation) String. Check out the Wikipedia article for more information on FEN Strings and their format.

let board = Board::from_fen("rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2").unwrap();

Applying and Generating Moves

Moves are represented with a BitMove structure. They must be generated by a Board object directly, to be considered a valid move. Using Board::generate_moves() will generate all legal BitMoves of the current position for the current player.

use pleco::{Board,BitMove};

let mut board = Board::start_pos(); // create a board of the starting position
let moves = board.generate_moves(); // generate all possible legal moves
board.apply_move(moves[0]);
assert_eq!(board.moves_played(), 1);

We can ask the Board to apply a move to itself from a string. This string must follow the format of a standard UCI Move, in the format [src_sq][dst_sq][promo]. E.g., moving a piece from A1 to B3 would have a uci string of "a1b3", while promoting a pawn would look something like "e7e81". If the board is supplied a UCI move that is either incorrectly formatted or illegal, false shall be returned.

eq, promotes to queen assert!(!success); // Wrong, not a valid move for the starting position">
let mut board = Board::start_pos(); // create a board of the starting position
let success = board.apply_uci_move("e7e8q"); // apply a move where piece on e7 -> eq, promotes to queen
assert!(!success); // Wrong, not a valid move for the starting position

Undoing Moves

We can revert to the previous chessboard state with a simple Board::undo_move()

let mut board = Board::start_pos();
board.apply_uci_move("e2e4"); // A very good starting move, might I say
assert_eq!(board.moves_played(),1);
board.undo_move();
assert_eq!(board.moves_played(),0);

For more informaton about pleco as a library, see the pleco README.md.

Contributing

Any and all contributions are welcome! Open up a PR to contribute some improvements. Look at the Issues tab to see what needs some help.

License

Pleco is distributed under the terms of the MIT license. See LICENSE-MIT for details. Opening a pull requests is assumed to signal agreement with these licensing terms.

Comments
  • Ready Pleco for Deployment in CCRL (Computer Chess Rating Lists)

    Ready Pleco for Deployment in CCRL (Computer Chess Rating Lists)

    To get a rough estimate about how Pleco performs against other engines, it needs to be submitted in the Computer Chess Rating System.

    However, a few things need to be done before that can happen.

    • [x] Finish the uci command line interface to allow for the full range of commands.
    • [x] Finish the LazySMP Searcher to use the TranspositionTable correctly, and allow the table to be resized and cleared.
    • [x] Allow parsing of the Board and Limits prior to the start of searching
    • [x] Allow for proper time management based on the UCI protocol
    • [x] Test the current TimeManagement struct for accuracy & parsing errors.
    • [ ] Submit to CCRL for engine rating

    Other things that would be of use:

    1. Implement use of opening Board bases, SysgzyBases I believe they are called.
    2. Allow for endgame board tables.
    enhancement searcher 
    opened by sfleischman105 9
  • Universal Chess Interface support and associated `UCISearcher` Trait.

    Universal Chess Interface support and associated `UCISearcher` Trait.

    In order to be considered a modern chess engine, Pleco needs to support the Universal Chess Interface (shorthand is UCI) inside of both the engine, as well as the primary searcher. More information about UCI can be found here.

    There are four parts I would like to outline for implementing this.

    1) main.rs args

    When given the command "uci" as an argument (or stdin after load), Engine::uci(...) should be called, letting the Engine handle it from there.

    2) Engine

    The Engine must contain a Engine::uci(...) method to allow for communication to and from the GUI. Communication uses stdin and stdout to pass commands back and forth. The command "isready" should allow the engine the opportunity to get both a UCI compatible Searcher (more on this later) and a Board object ready. The GUI can send in options to the Engine before the game actually begins, starting with the "setoption" command. All commands leading up to "go" (which starts the game) can be implemented with a simple IO loop.

    3) Mid Game Message sending to / from UCI Searcher

    When the Searcher is in the midst of searching, the Engine must act as an intermediary between the GUI and the Searcher. Mid-search, the GUI should only be able to send the command "stop" to the Searcher, which should within reasonable time stop the Search and return the best move found so good.

    Some problems that need to be dealt with in concern of this:

    • How do we allow stdin to be scanned in a separate thread, but without impacting search performance?
    • What type of structure do we need to pass into the UCI Searcher that allows for checking when to stop?

    Furthermore, the Engine needs to be able to do the opposite: Await information from the UCI Searcher and relay that information to the GUI.

    4) Implementing the UCISearcher Trait

    The UCISearcher Trait should mark specific Searchers as UCI compatible. Currently, the UCISearcher implementation is the following:

    pub trait UCISearcher: Searcher {
       fn uci_move(board: Board, timer: &Timer, rx: Arc<Mutex<Option<GuiToEngine>>>) -> BitMove where Self: Sized;
    }
    

    Some notes on this:

    • Receiver needs to be solidified in uci_move as determined by item 3.
    • A Sender needs to be given in somewhere, to allow the chess board to communicate back.
    • `fn configuration()' or similar function should allow easily setting up options.
    enhancement help wanted searcher 
    opened by sfleischman105 6
  • `Board::get_piece_locations()` causes stack overflow

    `Board::get_piece_locations()` causes stack overflow

    Running Board::get_piece_locations() causes a stack overflow when run. This is the code that causes this bug for me: let board = Board::start_pos() for (sq, piece) in board.get_piece_locations() { debug!("{} {:?}", sq, piece);}`

    opened by AntonHermann 5
  • Alternate Implementation of Parallel Search Strategy

    Alternate Implementation of Parallel Search Strategy

    Currently, all the parallel algorithms implement Principal Variation Splitting (See section on ChessProgramming Wiki) to utilize mutli-core processing. PVS works by searching a set amount of moves sequentially to find an alpha cut-off, and then the remaining nodes are searched in parallel with that alpha cutoff. Can this be done better?

    enhancement help wanted searcher 
    opened by sfleischman105 5
  • How to estimate a Bitmove with pleco::bots

    How to estimate a Bitmove with pleco::bots

    Hello, i am trying to teach neural-network : input as board + bitmove and output as score.

    So, i know that pleco provides this function https://docs.rs/pleco/latest/pleco/bots/minimax/fn.minimax.html for example. It returns best BitMove and Score for it.

    And my question : Is there any method in pleco like fn minimax_score_move(b: &Board, m: &BitMove) -> i16 that will return score for provided bitmove ?

    opened by xxxxxion 4
  • Unable to compile with Rust nightly

    Unable to compile with Rust nightly

    System Version: macOS 10.14.6 (18G103) Kernel Version: Darwin 18.7.0 rustc 1.41.0-nightly (25d8a9494 2019-11-29) Git: master, 0.1.5, 0.1.6

    error[E0635]: unknown feature `const_slice_len`
      --> pleco/src/lib.rs:77:42
       |
    77 | #![cfg_attr(feature = "nightly", feature(const_slice_len))]
       |                                          ^^^^^^^^^^^^^^^
    
    opened by alecho 4
  • Compile `pleco` with stable Rust

    Compile `pleco` with stable Rust

    The following features need to be stabilized before pleco can compile on stable:

    For benchmarking:

    • [x] test (Switched to Criterion with #92 )

    Dependency stabilization

    • [ ] lazy_static nightly (no current tracking issue)
    enhancement library 
    opened by sfleischman105 3
  • Doesn't Compile due to const_fn feature having been removed

    Doesn't Compile due to const_fn feature having been removed

    It looks like compilation (on Nightly, release) is failing due to:

    
    error[E0557]: feature has been removed
      --> pleco_engine\src/lib.rs:24:12
       |
    24 | #![feature(const_fn)]
       |            ^^^^^^^^ feature has been removed
       |
       = note: split into finer-grained feature gates
    
    
    opened by duganc 2
  • can't compile E0554

    can't compile E0554

    tried to build engine by:

    $ cargo build --release
    warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
    package:   /media/demo/1a16bb7d-7776-4545-b1d6-7f7ec43d7e64/Pleco/pleco/Cargo.toml
    workspace: /media/demo/1a16bb7d-7776-4545-b1d6-7f7ec43d7e64/Pleco/Cargo.toml
    warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
    package:   /media/demo/1a16bb7d-7776-4545-b1d6-7f7ec43d7e64/Pleco/pleco_engine/Cargo.toml
    workspace: /media/demo/1a16bb7d-7776-4545-b1d6-7f7ec43d7e64/Pleco/Cargo.toml
       Compiling prefetch v0.2.0
       Compiling crossbeam-utils v0.8.1
       Compiling memoffset v0.6.1
       Compiling num-traits v0.2.14
    error[E0554]: `#![feature]` may not be used on the stable release channel
      --> /home/demo/.cargo/registry/src/github.com-1ecc6299db9ec823/prefetch-0.2.0/src/lib.rs:18:1
       |
    18 | #![feature(link_llvm_intrinsics)]
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    error: aborting due to previous error
    
    For more information about this error, try `rustc --explain E0554`.
    error: could not compile `prefetch`
    

    How to solve this?

    opened by abdulbadii 2
  • Switch to  Criterion for Benchmarking.

    Switch to Criterion for Benchmarking.

    Right now, we use the standard libraries benchmarking tool for benchmarking.

    Despite it's easy of use, there are a couple drawbacks for using it:

    • No customization on the number of runs
    • Output is limited to a number + estimated degree of confidence

    It would be beneficial to switch the benchmarks to Criterion.rs, to get more detailed analysis of the benchmarks, alongside additional benchmark customization.

    enhancement help wanted searcher library 
    opened by sfleischman105 2
  • Replace the usage of `std::Arc` with faster internal version

    Replace the usage of `std::Arc` with faster internal version

    While great, the standard library's Arc could be made faster for our use case. To name one modification, we do not use the Weak pointer of the standard library Arc.

    Some inspiration for this could be from the Server Arc.

    enhancement help wanted optimization 
    opened by sfleischman105 2
  • Engine doesn't work in Arena

    Engine doesn't work in Arena

    I tried to use pleco_engine in Arena but it keeps panicking. I'm running it on Debian buster x86-64.

    Reproduction steps:

    1. Compile pleco_engine, add engine to Arena, then load it as engine 1
    2. Start engine
    3. Arena doesn't output analysis, and the logs show that it panicked
    2021-05-02 15:14:32.208**----------New game---2021-05-02 15:14:32,208 Sun -------------
    2021-05-02 15:14:33.370*1*Start calc, move no: 1
    2021-05-02 15:14:33.371-->1:ucinewgame
    2021-05-02 15:14:33.371-->1:isready
    2021-05-02 15:14:33.371<--1:readyok
    2021-05-02 15:14:33.378-->1:position startpos moves e2e4
    2021-05-02 15:14:33.378-->1:go wtime 300000 btime 300000 winc 0 binc 0
    2021-05-02 15:14:33.378<--1:info id 0 start
    2021-05-02 15:14:33.378<--1:thread '1' panicked at 'attempted to leave type `movepick::pick::Pick` uninitialized, which is invalid', /home/makoto/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:660:9
    2021-05-02 15:14:33.378<--1:stack backtrace:
    2021-05-02 15:14:33.379<--1:   0:     0x55fcb6c5c530 - std::backtrace_rs::backtrace::libunwind::trace::hdcf4f90f85129e83
    2021-05-02 15:14:33.379<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
    2021-05-02 15:14:33.380<--1:   1:     0x55fcb6c5c530 - std::backtrace_rs::backtrace::trace_unsynchronized::h2669e30cb82f6732
    2021-05-02 15:14:33.380<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
    2021-05-02 15:14:33.380<--1:   2:     0x55fcb6c5c530 - std::sys_common::backtrace::_print_fmt::hfbda19e17f6db318
    2021-05-02 15:14:33.380<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/sys_common/backtrace.rs:67:5
    2021-05-02 15:14:33.380<--1:   3:     0x55fcb6c5c530 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1a8751bf59281272
    2021-05-02 15:14:33.380<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/sys_common/backtrace.rs:46:22
    2021-05-02 15:14:33.380<--1:   4:     0x55fcb6c1b0ef - core::fmt::write::h7aa6cd0067dca82a
    2021-05-02 15:14:33.380<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/core/src/fmt/mod.rs:1094:17
    2021-05-02 15:14:33.380<--1:   5:     0x55fcb6c5bd44 - std::io::Write::write_fmt::hd7dd3a1df9b6befb
    2021-05-02 15:14:33.380<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/io/mod.rs:1580:15
    2021-05-02 15:14:33.380<--1:   6:     0x55fcb6c5b8c5 - std::sys_common::backtrace::_print::h551e9ec8a9fa8106
    2021-05-02 15:14:33.380<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/sys_common/backtrace.rs:49:5
    2021-05-02 15:14:33.380<--1:   7:     0x55fcb6c5b8c5 - std::sys_common::backtrace::print::ha4b1c5e95fa040b3
    2021-05-02 15:14:33.380<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/sys_common/backtrace.rs:36:9
    2021-05-02 15:14:33.380<--1:   8:     0x55fcb6c5b8c5 - std::panicking::default_hook::{{closure}}::h0b34c9ab7fb9f857
    2021-05-02 15:14:33.380<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/panicking.rs:208:50
    2021-05-02 15:14:33.380<--1:   9:     0x55fcb6c5a8bb - std::panicking::default_hook::h3067e8318decd17a
    2021-05-02 15:14:33.380<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/panicking.rs:225:9
    2021-05-02 15:14:33.380<--1:  10:     0x55fcb6c5a8bb - std::panicking::rust_panic_with_hook::h81b8facc50f34daa
    2021-05-02 15:14:33.381<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/panicking.rs:591:17
    2021-05-02 15:14:33.381<--1:  11:     0x55fcb6c75910 - std::panicking::begin_panic_handler::{{closure}}::ha376ab85d95a000e
    2021-05-02 15:14:33.381<--1:  12:     0x55fcb6c758ac - std::sys_common::backtrace::__rust_end_short_backtrace::h6795c8afdd1a77e6
    2021-05-02 15:14:33.382<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/sys_common/backtrace.rs:141:18
    2021-05-02 15:14:33.382<--1:  13:     0x55fcb6c7585d - rust_begin_unwind
    2021-05-02 15:14:33.382<--1:BytesRead > 0
    2021-05-02 15:14:33.382<--1:n > 0
    2021-05-02 15:14:33.382<--1:-- LiesThread.Execute terminated --
    2021-05-02 15:14:33.383<--1::5
    2021-05-02 15:14:33.383<--1:  14:     0x55fcb6c131f0 - core::panicking::panic_fmt::hbe99dddd3092ba3c
    2021-05-02 15:14:33.383<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/core/src/panicking.rs:92:14
    2021-05-02 15:14:33.383<--1:  15:     0x55fcb6c1313c - core::panicking::panic::h3de4db67bd397eb3
    2021-05-02 15:14:33.383<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/core/src/panicking.rs:50:5
    2021-05-02 15:14:33.383<--1:  16:     0x55fcb6c3ae2c - pleco_engine::search::Searcher::search::h5101e7830a14161b
    2021-05-02 15:14:33.383<--1:  17:     0x55fcb6c3a524 - pleco_engine::search::Searcher::search::h5101e7830a14161b
    2021-05-02 15:14:33.383<--1:  18:     0x55fcb6c36378 - pleco_engine::search::Searcher::search_root::ha097df830d13b18a
    2021-05-02 15:14:33.383<--1:  19:     0x55fcb6c359ac - std::sys_common::backtrace::__rust_begin_short_backtrace::hfe1ee00e5ba6c1af
    2021-05-02 15:14:33.383<--1:  20:     0x55fcb6c35679 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h5f7dd8b7c406aef8
    2021-05-02 15:14:33.383<--1:  21:     0x55fcb6c79455 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3aa31cb6360b59d9
    2021-05-02 15:14:33.383<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/alloc/src/boxed.rs:1546:9
    2021-05-02 15:14:33.383<--1:  22:     0x55fcb6c79455 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7719d3c7c5841461
    2021-05-02 15:14:33.383<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/alloc/src/boxed.rs:1546:9
    2021-05-02 15:14:33.383<--1:  23:     0x55fcb6c79455 - std::sys::unix::thread::Thread::new::thread_start::hfbe13ead469fd0bc
    2021-05-02 15:14:33.383<--1:                               at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/sys/unix/thread.rs:71:17
    2021-05-02 15:14:33.383<--1:  24:     0x7fe79102afa3 - start_thread
    2021-05-02 15:14:33.383<--1:  25:     0x7fe790dd34cf - clone
    2021-05-02 15:14:33.383<--1:  26:                0x0 - <unknown>
    
    opened by MakotoE 1
  • Reduce unsafe code

    Reduce unsafe code

    There are mutliple uses of unsafe that can be either replaced with safe code or with an external crate. I propose using this issue to discuss these cases and then document in the code why each unsafe is fine. This makes code review much easier.

    • Transmutes to enums. Totally fine although the compiler generates the same assembly for safe match statements.
    • Custom Arc without weak counter from servo_arc. The discussion to include this in std died here. Why not use the crate? The currently published version has possible UB https://github.com/servo/servo/issues/26358
    • Custom TranspositionTable that allows to trigger undefined behaviour from safe code (if I understand the code correctly):
    let tt = TranspositionTable::new_num_entries(40000);
    let prng = PRNG::init(932445561);
    let key: u64 = prng.rand();
    let (found1, entry1): (bool, &mut Entry) = tt.probe(key);
    let (found2, entry2) = tt.probe(key); // second mutable reference to the same object -> UB
    

    I did not look into the usecases yet. There are probably alternatives available in the ecosystem.

    • Custom TimeManager: Internals can be replaced with atomics and Ordering::Relaxed load/store (although the Instance might be problematic). Also: do not create mutable references from UnsafeCell in unguarded code but use ptr::write to avoid UB.
    • Unchecked array access with enums like this: https://github.com/sfleischman105/Pleco/blob/292d38e78dd7d82112aef79a379e8329707e3659/pleco_engine/src/tables/counter_move.rs#L24 I am quite sure that the compiler will elide the bound checks. Another possibility is to use enum_map or static asserts.
    • Remove static mut and replace it either with lazy_static or with const fn initialization. https://github.com/sfleischman105/Pleco/blob/292d38e78dd7d82112aef79a379e8329707e3659/pleco_engine/src/tables/pawn_table.rs#L82
    • Use arrayvec or tinyvec for MoveList.
    • mem::uninitialized to gether with an enum that encodes if a field is used or not. Is there a reason that this is a repr(u8) enum instead of carrying the data itself? https://github.com/sfleischman105/Pleco/blob/292d38e78dd7d82112aef79a379e8329707e3659/pleco_engine/src/movepick/mod.rs#L64
    opened by terrorfisch 0
  • Give speed comparisons vs Stockfish

    Give speed comparisons vs Stockfish

    The README says "This project is for speed comparisons between the two languages". Would you please update the README to give some speed comparisons between Pleco and Stockfish?

    opened by ngocdaothanh 1
  • Move generator benchmarks

    Move generator benchmarks

    Hi! I'm planning on writing a chess engine in rust to learn the language better and I'm looking for a move generator to use. I'm currently in between Pleco and chess. Do you have any benchmarks on which one is a faster move generator? Thanks in advance!

    opened by yukw777 0
  • End-Game Tablebases / Specialized Evaluation

    End-Game Tablebases / Specialized Evaluation

    This is probably the weakest part of the engine right now: playing well into the end-game.

    Porting over Stockfish End of Game table bases would fix this, and seems pretty easy to do.

    enhancement help wanted searcher 
    opened by sfleischman105 1
  • Compile `pleco_engine` with stable Rust

    Compile `pleco_engine` with stable Rust

    The following features need to be stabilized before pleco_engine can compile on stable:

    For benchmarking:

    • [x] test (Switched to Criterion with #92 )

    Dependency stabilization

    • [ ] lazy_static nightly (no current tracking issue)
    • [ ] pleco needs to be usable on stable as defined by #76 .
    enhancement searcher 
    opened by sfleischman105 2
Releases(0.1.6)
  • 0.1.6(Apr 29, 2019)

    Updated pleco to 0.5.0 and pleco_engine to 0.1.6

    Mostly little fixes, but most importantly, Pleco now compiles on stable Rust!

    pleco changes:

    • Now compiles on stable!!
    • Added nightly feature for advanced optimizations on nightly toolchain.
    • Modified move_list::MAX_MOVES to adjust for cache size based on target pointer width.
    • Removed prefetch dependency and added a new prefetch.
    • Improved PRNG::singular_bit()'s randomness (Better distribution of bits).
    • Allocation now depends on Alloc, not GlobalAlloc.
    • popcount now uses a table lookup by default. -bit_scan_forward now does an unchecked lookup on the De Bruijn table
    • minimax cleanup.

    pleco_engine changes:

    • Modified prefetch instructions to use pleco::prefetch_write
    • Refactored some methods in threadpool.rs
    Source code(tar.gz)
    Source code(zip)
    pleco.exe(401.00 KB)
  • 0.1.5(Mar 5, 2019)

    Updated pleco to 0.4.4 and pleco_engine to 0.1.5.

    Features fixes to work around nightly breaking changes, dependency changes, and bug fixes.

    Seems to be around a 10-15% speed bump from the last release. Wahoo! Though, this can be mostly attributed to compiler updates, rather than any of the changes in this release.

    pleco changes:

    • Turn PieceLocations Iterator from recursion to loop, to prevent stack overflow
    • Convert const arrays to static
    • Fixed `Piece::{Display,Debug}' to faster implementations (Fix #117)
    • Remove SIMD functions
    • Remove clippy cfgs.
    • Updated dependencies.

    pleco_engine changes:

    • Global Timer now initialized through static array, rather than through static pointer
    • Remove clippy cfgs.
    • Remove dependency on crossbeam, as unsafely scoped threads are available in the standard library.
    • Updated benchmarks to initialize lazy_static statics before benchmarking.
    • Updated dependencies.
    Source code(tar.gz)
    Source code(zip)
    pleco.exe(401.50 KB)
  • 0.1.4(Aug 19, 2018)

    Updated pleco to 0.4.3 and pleco_engine to 0.1.4.

    Nothing too significant, mostly fixing issues with the new allocation system.

    pleco changes:

    • Added new 'unreachable_unchecked hint, removing dependency on unreachable` crate.
    • Added repr(transparent) to BitMove, Sq, and BitBoard.
    • Fixed zobrist typo
    • Added #[cold] attributes to startup functions.
    • Changed MoveType from a u16 to u8.
    • Fixed allocation issues.
    • Updated dependencies.

    pleco_engine changes:

    • Added #[cold] attributes to startup functions.
    • Changed VERSION string to a macro referencing current cargo version
    • Fixed allocation issues.
    • The global Threadpool and transposition table are now in a fixed memory locations.
    • Updated dependencies.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.3(May 16, 2018)

  • 0.1.2(May 15, 2018)

    Release of version 0.1.2

    Significant bug fixes and optimizations, especially for evaluation. Many of Stockfish's searching features are implemented with this release, such as depth extensions / reductions, shallow depth pruning, and many more.

    This version will fail to run with recent nightly compilers!

    This is due to recent changes in std::alloc and similar modules. As such, there will be no binary for this release, as that'll come with 0.1.3 to address the recent changes in nightly. This will land very soon.

    Changelog

    General

    • updated pleco to 0.4.1
    • updated pleco_engine to 0.1.2
    • README's updated to reflect the work of the stockfish team.

    pleco changes:

    • Fixed bug with Castling::player_can_castle() returning incorrect results.
    • Added Board::castling_bits() to return the raw u8 of the castling rights
    • Added Board::non_pawn_material_all() to return the sum of both player's npm.
    • Added Board::opposite_bishops() to check if the only non Pawn/King pieces are two bishops of opposite players, being on opposite square types.
    • File::bb() and Rank::bb()` for returning the BitBoards of Files/Ranks
    • Score::centipawns() for returning the value of a score in centipawns. This is a value mostly for UCI displaying purposes.
    • impl Display for Score. This returns a nicely formatted version of the score in centipawns.
    • Added SQ::opoosite_colors(other: SQ) for quick determining if two squares lie on oppositely colored squares.
    • Added PreFetchable trait, containing only two methods, prefetch. Allows for memory prefetching of certain structures. This is created for use by pleco_engine in applying a move. It prefetches the location of a pawn table and material table. Applying a move can still be done without prefetching, due to the use of a "dummy" structure, which gets optimized away.
    • Changed apply_unknown_move to apply_move_pft_chk, and added generic prefetching parameters. These are used for a Pawn Table and Material table respectively, as mentioned above.
    • TranspositionTable now implements prefetching!

    pleco_engine changes

    • Removed the InCheck parameter from qsearch (As Stockfish has done so recently as well). This has simplified the calling of qsearch, as the callee doesn't need to know if it's in check, as qsearch now does that automatically.
    • depth is now a i16 across the board. This is for having negative depths with qsearch, as it's searching past the horizon.
    • Eval changes:
      • Connectivity and Queen Slider bonus's!
      • Completed the tracing function, added to the Eval function as a method.
      • Added an EvaluationInner to distinguish internal vs. External access to evaluation.
      • removed attacked_by_all and attacked_by_queen_diagonal from EvaluationInner
      • Added a Evaluation::scale_factor() method to further scale between mid and end-game scores
      • Significant bug fixes resulting in a more accurate evaluation. This is by far the biggest improvement currently.
    • Search algorithm changes:
      • Altered timing parameters. This will continue to fluctuate as testing continues.
      • Added an excluded_move search for pruning the possibility of a better non-tt move.
      • tt_move now defaults to the first root move when at root.
      • Added improving factor to futility pruning.
      • Singular Extensions
      • Shallow depth pruning
      • Reduced Depth LMR Search
      • Reductions / Extensions
      • Added cut_node and ski_early_pruning fields for search
    • Material changes:
      • Fixed bug where the scale factors would default to zero, instead of the normal scale factor
      • Now implements PreFetchable.
    • PawnEntry changes:
      • Separated out the score to be per player.
      • Now implements PreFetchable.
      • Bug fixes
    • Added startup generated Search tables for continuity checking.
    • TableBase now has a const size associated with it, to allow for constant indexing. Also means no more resizing.
    • Removed the use of lazy_static, and instead perform any needed statics with init_globals. This also means calls to TIMER have been changed to timer(), and respectively with the transposition table.
    • Added mated_in and mate_in for returning scores within a mate value.
    • Added value_from_tt and value_to_tt for retrieving and setting tt values with respect to the current ply.
    • Searcher::pv now returns results correctly, including ignoring infinite values. Also can return the distance to a mate, if available.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.1(Apr 1, 2018)

Owner
Stephen Fleischman
Software Engineer working in Seattle.
Stephen Fleischman
Chess implemented entirely in the Rust and TS type systems.

Type System Chess This repo contains chess implemented entirely in the (stable) Rust and Typescript type systems. Both languages feature turing comple

null 170 Jul 12, 2023
Walleye is a chess engine written completely in rust.

Walleye is a UCI-compatible engine written using the classical alpha-beta style AI. It supports loading board positions from arbitrary FEN strings, Unicode pretty printing to the console, and UCI communication logs to help with debugging.

Mitchel Paulin 95 Dec 24, 2022
Blackmarlin is a chess engine fully written in Rust.

Blackmarlin WIP UCI Chess Engine Blackmarlin is a chess engine fully written in Rust. Make sure to compile the chess engine with cargo build --release

null 50 Oct 31, 2022
A basic web assembly chess engine written in rust.

This library is a basic implementation of a chess min-max algorithm with alpha-beta pruning (Algorithm Info). It is designed to be compiled down to WebAssembly and used for web applications.

null 2 Nov 25, 2022
A Chess Engine written in Rust that runs natively and on the web!

About The Project chess-rs is a Chess Engine written from scratch in Rust that runs natively and on web! Live Demo: https://parthpant.github.io/chess-

Parth Pant 109 Apr 6, 2023
A Chess Engine written in Rust .

Kelp Kelp is a UCI compatible chess engine written in Rust Using standard chess algorithms. Kelp is work in progress. Currently, it can be used as a U

Gautam 5 Sep 3, 2023
A dependency-free chess engine library built to run anywhere.

♔chess-engine♚ A dependency-free chess engine library built to run anywhere. Demo | Docs | Contact Me Written in Rust ?? ?? Why write a Chess engine?

adam mcdaniel 355 Dec 26, 2022
🎮 A Realtime Multiplayer Server/Client Game example built entirely with Rust 🦀

Example of a ?? Realtime Multiplayer Web Game Server/Client built entirely using Rust ??

Nick Baker 5 Dec 17, 2022
A rust chess implementation using a neural network scoring function built on huggingface/candle + rust + wasm

Rusty Chess What is it? Rusty Chess aims to be a high quality embeddable chess engine that runs entirely locally in the browser (no backend required).

Gareth 3 Nov 3, 2023
Yet another shape chess game in Rust.

shape_chesss_in_rust Yet another shape chess game in Rust. Why the implementation is so slow? The main reason is performance of Vector iteration is ve

Simon Lee 1 Apr 10, 2022
Opening randomizer for Chess

chess-randomizer chess-randomizer is a simple opening randomizer written in Rust using WASM and the Lichess API. To build the project, you need Rust a

null 1 Jan 31, 2022
Play jungle chess on the linux terminal.

Jungle-Chess This is my first project written in Rust. Happy for contributors and feedback! The code is dirty. Play Jungle Chess on an Emoji-Enabled L

Arne Winter 10 Aug 9, 2022
An (experimental) chess tactics trainer with spaced repetition

better-tactics A chess tactics trainer that with spaced repetition. New puzzles will be shown to you from the lichess puzzle db, according to your cal

Caitlin Wilks 6 Oct 6, 2023
Minecraft-esque voxel engine prototype made with the bevy game engine. Pending bevy 0.6 release to undergo a full rewrite.

vx_bevy A voxel engine prototype made using the Bevy game engine. Goals and features Very basic worldgen Animated chunk loading (ala cube world) Optim

Lucas Arriesse 125 Dec 31, 2022
A no-frills Tetris implementation written in Rust with the Piston game engine, and Rodio for music.

rustris A no-frills Tetris implementation written in Rust with the Piston game engine, and Rodio for music. (C) 2020 Ben Cantrick. This code is distri

Ben Cantrick 17 Aug 18, 2022
Rustcraft is a simple Minecraft engine written in rust using wgpu.

Rustcraft is a simple Minecraft engine written in rust using wgpu.

Raphael Van Hoffelen 110 Dec 22, 2022
A feature-rich, production-ready, general purpose 2D/3D game engine written in Rust with a scene editor.

A feature-rich, production-ready, general purpose 2D/3D game engine written in Rust with a scene editor.

rg3d engine 5.4k Jan 4, 2023
A game of snake written in Rust using the Bevy game engine, targeting WebGL2

Snake using the Bevy Game Engine Prerequisites cargo install cargo-make Build and serve WASM version Set your local ip address in Makefile.toml (loca

Michael Dorst 0 Dec 26, 2021
My first Real-Time 3D Game Engine learning project written in Rust.

EyeEngine-Rust FOA, sry for my poor English. What is Eye Engine? Eye Engine is my first Real-Time 3D Game Engine learning project. There are two editi

F-seeeye 4 Jan 5, 2022