Skip to content

TampliteSK/Dragonrose_Cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

255 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dragonrose chess engine logo

Dragonrose logo created by vividgamer5

Dragonrose_Cpp Chess Engine

Build Status

Overview

Dragonrose is a UCI-compliant chess engine written in C++. The engine is a command-line interface (CLI), therefore it is highly recommended to use Dragonrose via a graphic-user interface (GUI) that supports UCI, such as En Croissant, Arena or Banksia, in order to have a better user experience.
This repository is a rewrite of the original C Dragonrose.

Notable differences with older repo:

  • Uses plain magic bitboards to generate attacks, storing them in pre-generated attack tables for lookups later
  • No longer uses the built-in opening book that comes with VICE
  • More consistent naming convention, data types and parameter ordering
  • Takes inspiration from more engines

You are free to borrow and/or modify my code if you so wish, as long as you give credit.
To use the engine, either grab the binary from releases, or build the project locally. In the future I will consider releasing Linux builds.

Inspirations and Acknowledgments

Dragonrose is greatly inspired by VICE chess engine, developed by Richard Allbert (Bluefever Software), which is a didactic chess engine aimed to introduce beginners to the world of chess programming. Huge credits to him for creating the YouTube series explaining the engine in great detail.

Aside from VICE, Dragonrose also draws inspiration from other engines such as

  • Ethereal by Andrew Grant (AndyGrant) et al.
  • Weiss by Terje Kirstihagen (TerjeKir) et al.
  • BBC by Maksim Korzh (Code Monkey King), and
  • Caissa by Michal Witanowski (Witek902) et al.

I would also like to thank:

  • mcthouacbb (better known as A_randomnoob on Discord), developer of the most goated HCE engine Sirius, for looking through search.cpp and discovering silly bugs in my engine.
  • Adam Kulju, developer of Willow and Patricia, for helping out with my code.
  • MattBench (an instance of OpenBench) users for contributing hardware and helping with code as well
  • vividgamer5 for creating the Dragonrose logo

How to Use

  • Challenge it on Lichess here
  • To run it locally either download a binary from releases or build it yourself with the makefile. Run make CXX=<compiler> and replace compiler with your preferred compiler (g++ / clang++). With it you can pick one of two options:
    • Plug it into a chess GUI such as Arena or Cutechess
    • Directly run the executable (usually for testing). You can run it normally with ./Dragonrose or run a benchmark with ./Dragonrose bench

UCI options

Name Type Default Valid values Description
Hash integer (spin) 16 [1, 262144] Size of the transposition table in megabytes (MB). 16 - 512 MB is recommended for most use cases.
Bench CLI Argument - - Run ./Dragonrose_Cpp bench (or whatever you named the binary) from a CLI to check nodes and NPS, based on a 50-position suite (from Heimdall).

Main Features

Search

  • Iterative deepening + Aspiration windows
  • Negamax alpha-beta search (fail-soft)
    • Mate distance pruning
    • Whole node-pruning
      • Reverse futility pruning (RFP)
      • Null-move pruning (NMP)
    • Move-loop pruning
      • Late move pruning (LMP)
      • Futility pruning (extended to depth 3)
    • Late move reductions (LMR) + Principal-variation Search (PVS)
  • Quiesence search (fail-soft)
  • Move ordering: MVV/LVA, Killer heuristics, Priority moves (promotions, castling, en passant)
  • Transposition table using "age"

Evaluation (Hand-crafted evaluation, or HCE)

  • Tapered eval

    • PesTO Material & Piece-square Table (PST/PSQT) bonuses
    • Piece activity
    • Tempi
  • King safety

    • Attack units
    • Pawn shield
    • King mobility (in endgames)
  • Piece mobility (NBRQ)

  • Piece bonuses / penalties

    • Mobility (NBRQ)
    • Bonus for semi-open/open files (RQ)
    • Bonus for targetting enemy pieces (BRQ)
    • Bonus for batteries (B+Q, R+Q, R+R)
    • Penalty for bishops blocking centre pawns
  • Pawn structure

    • Passed pawns bonus
    • Isolated pawns penalty (extra penalty for isolated d/e pawns)
    • Stacked pawns penalty
    • Backwards pawns penalty
    • Phalanx pawns bonus (WIP)
  • Basic drawn endgame knowledge

Others

  • Attack generation
    • Pre-computed attack tables initialised at startup
    • Plain magic bitboards for slider attacks
  • Time management
    • Simple hard time limit + varying soft time limit based on ply (phase)

Playing Strength

Version CCRL 2+1 est. UBC
v0.29 (dev) ~2264 -
v0.25 ~2136 2157
  • CCRL rating estimates are obtained from tests against Stash v17 (rated 2295 CCRL 2+1).
  • Note that the estimated ratings in the C repo are not accurate, as the engine used in gauntlets are bugged.

Below are some other metrics:

Metric Rapid Blitz Bullet
Lichess (BOT) 2208 ± 62 2160 ± 48 2158 ± 48
Chesscom* (est.) 2655 ± 109 2888 ± 88 2675 ± 338

*: These Chesscom ratings are estimated based on its games against human players (rated 1800 - 2500), though the sample size is fairly small.

Useful Resources

  • VICE video playlist (as linked above)
  • Chess Programming Wiki. Great resource in general to learn concepts.
  • Analog Hors for this guide explaining magic bitboards in an understandable format. By far much better than any other resource I have found.
  • nemequ, mbitsnbites, zhuyie et al. for TinyCThread.

Changelogs

0.x:

0.29 (dev): Completely rewritten from scratch, surpassed 0.28 and 0.25.

  • Eval: Reworked structure and more terms
  • Search: Improved NMP, FP/EFP & LMR. Added PVS, RFP, LMP, MDP. Switched to fail-soft entirely. Added TT probing in QS.
  • Other: Patched misc bugs.

To-do list

  • Release at 2500 CCRL (vs. Stash), and then next big release at 3000.
  • Search / Eval progression
  • ...
  • Search thread / LazySMP
  • Add Chess960 support

Bugs to fix:

  • Illegal PV moves
  • Occasional disconnects on OB in perpetual checks positions on specific machines

About

A weak chess engine written in C++, not to be confused with another engine literally called "Weak".

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors