Skip to content

Weak UCI-compliant chess engine written in C. Based on VICE chess engine by Richard Allbert (Bluefever Software).

License

Notifications You must be signed in to change notification settings

TampliteSK/dragonrose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dragonrose Chess Engine

Dragonrose is a weak UCI-compliant chess engine written in C. This is merely a passion project of mine, and I certainly don't expect much to come out of it, but I hope to learn a bit more about C and programming in general through this experience. On top of this, the engine will be written with readability in mind, so 1) it is easier to understand and 2) I am not good enough to optimise the code much :P.
Although this engine is probably too trash for anyone to bother using as a reference, you are free to borrow and modify my code if you so wish, as long as you give credit to both me and Bluefever Software (see below for details).
To use the engine, either grab the binary from releases, or build the project locally. In the future I will consider releasing Linux builds.

Dragonrose and VICE

Dragonrose is based on VICE, a chess engine written 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.
Note that aside from most of the code itself, the internal book (VICEbook.bin) is also created by Allbert.

You can find the playlist here: Link to playlist

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 CC=<compiler> and replace compiler with your preferred compiler (gcc / 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) 64 [1, 65536] Size of the transposition table in megabytes. 16 - 512 MB is recommended.
Book boolean (check) TRUE TRUE / FALSE Whether to use the internal book (VICEbook.bin). The book and the binary must be in the same directory.
Bench CLI Argument - - Run ./Dragonrose bench from a CLI to check nodes and NPS based on a 50-position suite (from Heimdall). As it stands the node count is inconsistent even with the same version.

Main Features

Search:

  • Negamax Alpha-beta search
    • PV-search
    • Null-move pruning
    • Futility pruning
    • Late move pruning
  • Quiesence search
    • Delta pruning
  • Move ordering: MVV/LVA, Killer heuristics, Priority moves (Castling, en passant)
  • Iterative deepening
  • Transposition table using "age"
  • Polyglot opening books

Evaluation (Hand-crafted evaluation (HCE)):

  • Tapered eval
    • Material
    • Piece-square table bonuses
  • King safety: customised king tropism, pawn shield, king open files penalty, king in centre penalty
  • Piece bonuses: Rook/queen open-file bonuses
  • Pawn bonuses / penalties: Passed pawns, isolated pawns, stacked pawns
  • Endgame knowledge: Drawn endgame detection (7-man equivalent), 50-move rule adjustment

Playing Strength

  • Latest version is about 2350 CCRL in strength. At the moment it is quite inconsistent in tests, so the estimate may not be accurate.
  • The Chesscom rating is estimated based on its games against human players (1800 - 2500). However it suffers greatly from small sample size, so take it with a grain of salt.
Metric Rapid Blitz Bullet
CCRL 2350? N/A 2350?
Lichess (BOT) 2221 ± 57 2074 ± 51 2104 ± 54
Chesscom (est.) 2591 ± 239 2760 ± 178 2659 ± 227

Credits

  • Richard Allbert (Bluefever Software) for VICE code and video playlist. The entire reason this engine even exists.
  • Chess Programming Wiki. Great resource in general to learn concepts.
  • Witek902 for Caissa chess engine. I borrowed its tapered eval weighting formula.
  • nemequ, mbitsnbites, zhuyie et al. for TinyCThread.

Changelogs

0.x:

0.28 (dev): Rework king safety. Added extended futility pruning. Improved endgame knowledge. | Elo gain: ~5.
0.27c: Added doubled pawns. Improved time management. Minor code restructuring.
0.27b: Improved aspiration windows. Improved move ordering. Added OpenBench support. | Elo gain: ~30.
0.27: Added late move pruning. Improved drawn endgame detection. Optimised king tropism. | Elo gain: ~50.
0.26d: Added aspiration windows.
0.26: Added king tropism. Improved time management.
0.25: Added futility pruning. | Elo gain: ~20.
0.24c: Enabled O3 optimisation. Added mate ouptut.
0.24b: Fixed delta pruning. Optimised memory (variable sizes).
0.24: Added delta pruning. Added punishments for minor pieces in front of pawns. | Elo gain: ~40.
0.23: Added king safety to evaluation (pawn shield and punish open files near king).
0.22: Improved time management (tested on Lichess). Slight speed boost.
0.21: Slight speed boost.
0.2: Fixed crash. Improved tapered eval. | Elo gain: ~240.
0.11: Added tapered eval to material (point values).
0.1: Added tapered eval to PSQT.

To-do list

  • Improve king safety
  • Add TT move ordering
  • Tune LMR
  • Add SEE
  • Pawn / bishop interaction
  • Optimise movegen (magic bitboard)
  • Search thread / LazySMP

Bugs to fix:

  • May blunder threefold in a winning position due to how threefold is implemented
  • Fix perft command freeze
  • ID loop needs to only exit when it has a legal move (i.e done depth 1 at least)
  • Obscure illegal move bug that occurs once every 100-200 games. Not replicable just with FEN.

About

Weak UCI-compliant chess engine written in C. Based on VICE chess engine by Richard Allbert (Bluefever Software).

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published