Giter VIP home page Giter VIP logo

xadrez's Introduction

Xadrez

Rust

A chess engine written in Rust.

Usage

Xadrez uses Rusts built-in package manager Cargo.

To use Xadrez in your projects, first include it as a dependency in your Cargo.toml.

[dependencies]
xadrez = { path = "path/to/xadrez" }
xadrez = { git = "https://github.com/jovialen/xadrez" }
use xadrez::prelude::*;
use xadrez::search::MoveSearcher;
use std::time::Duration;

fn main() {
	let chessboard = Chessboard::default();

	let moves: Vec<Move> = chessboard.moves();
	let pieces: Vec<(Piece, Square)> = chessboard.pieces();

	chessboard.make_move(moves[1]);

	let fen = chessboard.to_string();

	chessboard.set_position("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1");

	chessboard.make_move(Move::from_str("e2e4"));

	println!("{}", chessboard.evaluate());
	
	let best_move = MoveSearcher::new(&chessbboard)
		.max_depth(10)
		.max_time(Duration::from_secs(5))
		.search()
		.expect("Failed to find move");
	chessboard.make_move(best_move);
}

Use the cargo doc command to generate the full documentation.

Tests

To run the full test suite, run Cargos test command.

foo@bar:~$ cargo test

It is also recommended to use the --release flag as some of the tests take a long time to run.

Benchmarks

Xadrez also has benchmarks which you can use to test the performance of the engine on your system.

foo@bar:~$ cargo bench

xadrez's People

Contributors

jovialen avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.