Skip to content

Rustic is a chess engine. It is written from scratch in the Rust programming language.

License

Notifications You must be signed in to change notification settings

mvanthoor/rustic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rustic Banner

https://rustic-chess.org/

Rustic Chess Engine

Rustic is a chess engine written from scratch in the Rust programming language. It is not derived from any other engine, but it uses many concepts that have been well-known in chess programming for many decades; therefore, the engine still stands on the shoulders of the giants of the past.

User interface

The engine does not provide its own user interface. It uses the UCI and XBoard protocols to communicate with graphical user interfaces. (XBoard is not yet completely implemented at the time of writing. For now, use the engine in UCI mode, which is also the default.) It is recommended that you use a GUI to play games against the engine. Rustic is tested with these user interfaces:

There are many other user interfaces that will probably work just fine, but its obviously impossible to test all of them. If you have problems with a user interface, open an issue so I can see if it can be fixed. (Assuming the user interface is either free or open source, as I can't go and buy GUI's just for testing purposes.)

Features

The current feature-set for Rustic Alpha 3.0.0 is:

  • Engine:
    • Bitboard board representation
    • Fancy Magic bitboard move generator
    • Transposition Table
    • UCI-protocol
  • Search
    • Alpha/Beta search
    • Quiescence search
    • Check extension
    • PVS
  • Move ordering
    • TT Move priority
    • MVV-LVA
    • Killer moves
  • Evaluation
    • Material counting
    • Piece-Square Tables

(See changelog.md for more information.)

Included binaries, supported platforms

Each release contains several binaries; these are compiled for different types of CPU's. The following binaries are supplied:

  • bmi2: Intel Haswell (2013), AMD Zen 3 (2020)
  • popcnt: Intel Nehalem (2008), AMD Bulldozer (2011), AMD Zen 1 and 2 (2017)
  • old: Intel Core2 Duo (2006) and AMD CPU's between 2003 and 2011
  • ancient: For the very first 64-bit CPU's (2003)
  • i686: Intel Pentium II (1998) (Windows only), 32-bit
  • arm: Raspberry Pi 3 and 4 (not tested on RPi 1 and 2)

Windows still supports a 32-bit executable. Note that this executable is at 50% slower (half the speed) as compared to the 64-bit one and not as well tested. Many Linux-distributions have dropped support for 32-bit native Linux software, so no 32-bit executable for Linux is provided. The same is true for MacOS. The executable for the Raspberry Pi will be 32-bit as long as the 32-bit version of Raspbian OS is the default and 64-bit is experimental.

You can use the binary which runs fastest on your particular system for maximum playing strength. Start a terminal, and run each Rustic version:

$ ./<executable_name> -p7 -h512

This will run perft 7 from the starting position, using a 512 MB transposition table. Pick the version that runs perft 7 the fastest. If a binary crashes, your CPU does not support the required instructions to run it. Try a different binary.

If you wish to run Rustic on a system for which no binary is supplied, you can try to compile the engine yourself using the compilation tips below. Make sure to install at least Rust version 1.46.

Quick compiling tips

The engine includes a Makefile since Rustic Alpha 3.0.0, which makes building the engine easier. If you wish to build the engine yourself, you can find some quick tips below. These are meant for people who have some experience with setting up build environments, or have them installed already. If more information is required, see the file "build.md", or Rustic's documentation.

Build environment

  • Install Rust for your platform
  • Windows: Install MSYS2
    • Make sure you install the following parts:
      • CoreUtils
      • BinUtils
      • GCC
      • Make
  • MacOS:
    • Install HomeBrew
    • Install GNU Make
    • The command is "gmake" instead of "make", as MacOS includes its own (very old) version of "make".
  • Make sure you install the correct Rust target for your platform, using Rustup:
    • Linux:
      • stable-x86_64-unknown-linux-gnu
    • Windows:
      • stable-x86_64-pc-windows-gnu (This toolchain creates compiles that are compatible with the GNU GDB-debugger.)
      • stable-x86_64-pc-windows-msvc (This toolchain creates compiles that are compatible with Windows/Visual Studio's debugger. This will require the Microsoft Visual C++ Build Tools, because it uses the Microsoft Linker.)
  • Install Git for your platform.

Building Rustic

  • Start the terminal for your platform: MSYS2 (MinGW64 or MinGW32 version) for Windows, Terminal on Mac, and for Linux, your favorite terminal emulator.
  • Clone Rustic: "git clone https://github.com/mvanthoor/rustic.git"
  • Switch to the "rustic" folder.
  • Run "make" (Windows, Linux) or "gmake" (MacOS).
  • A ./bin folder should be created. The Makefile will build all versions of Rustic for the operating system and CPU you're running on.

Extra module

There is a module called "Extra", which copmiles some extra capabilities into the Rustic executable.

  • Command-line option -e: Rustic can run a perft suite containing 172 tests, to see if its move generator, make, and unmake are working as intended. This is mainly useful for developers.
  • Command-line option -w: Using this option, Rustic can perform Wizardry: it runs a function that generates magic numbers for use in a magic bitboard engine which has square A1 = 0, or LSB, and square H8 = 63. This is mainly useful if one wants to write their own chess engine, bus has no interest in writing a function to compute the magic numbers. (Though, doing so, will make understanding of magic bitboards much more complete.)

This module can be included by using the --features option of cargo:

cargo build --release --features "extra"

All command-line options

USAGE:
    rustic.exe [FLAGS] [OPTIONS]

FLAGS:
        --help        Prints help information
    -k, --kiwipete    Set up KiwiPete position (ignore --fen)
    -q, --quiet       No intermediate search stats updates
    -V, --version     Prints version information

OPTIONS:
    -c, --comm <comm>          Select communication protocol to use [default: uci]  [possible values: uci, xboard]
    -f, --fen <fen>            Set up the given position [default: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -
                               0 1]
    -h, --hash <hash>          Transposition Table size in MB [default: 32]
    -p, --perft <perft>        Run perft to the given depth [default: 0]
    -t, --threads <threads>    Number of CPU-threads to use [default: 1]

Please note that the -e (--epdtest) and -w (--wizardry) options are only available if the "extra" module is compiled into the engine.

Credits

More extensive credits can be found in "credits.md", or in Rustic's documentation.

Many people have assisted in one way or another, in the development of Rustic. They are listed below, in no particular order.

My girlfriend (for providing lots of support in more ways than she'd ever be able to realize), Richard Allbert, Terje Kirstihagen, Fabian von der Warth, H.G. Müller, Maksim Korzh, Rasmus Althoff, Martin Sedlák, Ronald de Man, Taimo, Sven Schüle, Thomas Jahn, Ed Schröder and Robert Hyatt (for still hanging around the chess programming community after 40 or 50 years).

All of these people (except my girlfiriend) can be found on the Talkchess.com forum.