All Projects → sfleischman105 → Pleco

sfleischman105 / Pleco

Licence: mit
A Rust-based re-write of the Stockfish Chess Engine

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Pleco

php-chess
A chess library for PHP.
Stars: ✭ 42 (-69.34%)
Mutual labels:  chess, board, engine
Ccxt.net
CCXT.NET – CryptoCurrency eXchange Trading Library for .NET
Stars: ✭ 89 (-35.04%)
Mutual labels:  bot, library
Discord.js Menu
💬 Easily create Discord.js v12 embed menus with reactions and unlimited customizable pages.
Stars: ✭ 89 (-35.04%)
Mutual labels:  bot, library
Geotic
Entity Component System library for javascript
Stars: ✭ 97 (-29.2%)
Mutual labels:  engine, library
Everydaywechat
微信助手:1.每日定时给好友(女友)发送定制消息。2.机器人自动回复好友。3.群助手功能(例如:查询垃圾分类、天气、日历、电影实时票房、快递物流、PM2.5等)
Stars: ✭ 8,688 (+6241.61%)
Mutual labels:  bot, ai
Vulkan2drenderer
Easy to use 2D rendering engine using Vulkan API as backend.
Stars: ✭ 60 (-56.2%)
Mutual labels:  engine, library
Slack Machine
A sexy, simple, yet powerful and extendable Slack bot
Stars: ✭ 91 (-33.58%)
Mutual labels:  bot, ai
Mineflayer Statemachine
A state machine plugin for Mineflayer to aid in designing more complex behavior trees.
Stars: ✭ 32 (-76.64%)
Mutual labels:  bot, ai
Botonomous
A PHP Framework For Creating Autonomous Slack Bots
Stars: ✭ 109 (-20.44%)
Mutual labels:  bot, ai
Sketal
Бот для ВКонтакте. Беседы / группы / развлечения.
Stars: ✭ 119 (-13.14%)
Mutual labels:  bot, engine
Math Engine
Mathematical expression parsing and calculation engine library. 数学表达式解析计算引擎库
Stars: ✭ 123 (-10.22%)
Mutual labels:  engine, library
Dialogflow Angular5
💬 Bot in Angular 5 & DialogFlow
Stars: ✭ 52 (-62.04%)
Mutual labels:  bot, ai
Caloriecounter
AWS Lex based chatbot that calculates calories based on different fast food restaurants. This was an entry for a coding challenge on DevPost, and is actively used on Facebook Messenger. The issues list is actively managed as what defects or improvements are found by real world usage.
Stars: ✭ 46 (-66.42%)
Mutual labels:  bot, ai
Accord
Data validation library for Rust
Stars: ✭ 72 (-47.45%)
Mutual labels:  library, crates
Pytlas
An open-source 🤖💬 Python 3 assistant library built for people and made to be super easy to setup and understand
Stars: ✭ 34 (-75.18%)
Mutual labels:  bot, ai
Amadeus Node
Node library for the Amadeus Self-Service travel APIs
Stars: ✭ 91 (-33.58%)
Mutual labels:  ai, library
Py3 Pinterest
Fully fledged Python Pinterest client
Stars: ✭ 133 (-2.92%)
Mutual labels:  bot, board
Awareness
The new architecture of co-computation for data processing and machine learning.
Stars: ✭ 11 (-91.97%)
Mutual labels:  ai, library
Openkore
A free/open source client and automation tool for Ragnarok Online
Stars: ✭ 956 (+597.81%)
Mutual labels:  bot, ai
Botacspro Bot Auto checkout Flashsale Shopee Promo
Bot Auto Checkout Flashsale Shopee Promo (Botacs Pro)
Stars: ✭ 107 (-21.9%)
Mutual labels:  bot, ai

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.

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].