Skip to content

lynx-chess/Lynx

Repository files navigation

Lynx

Lynx build Lynx release

Introduction

Lynx is a chess engine developed by @eduherminio.

It's written in C# (.NET 9).

You can find Lynx:

Lichess bot can be played directly, but a chess GUI that supports UCI protocol is needed to play against the self-contained version.

Strength

See Releases for the complete list of versions.

Here are the ones 'properly' rated over at least a few hundred of games:

Version Date Estimated
elo0
CCRL CCRL
Blitz
MCERL CEGT
40/20
CEGT
40/4
CEGT
5+3 pb
1.7.0 2024-10-05 3101 3111 3127 3206 2974 2936
1.6.0 2024-08-15 2952 2981* 3039
1.5.1 2024-06-21 2830 2851 2660 2690
1.5.0 2024-06-09 2817 2817
1.4.0 2024-03-21 2747 2753
1.3.0 2024-02-04 2651 2682 2653 2831
1.2.0 2024-01-11 2611 / 25511 2586 2862
1.1.0 2023-12-14 2533 2507 2426 2597
1.0.1 2023-11-20 2511 2433 2430 2566
0.19.0 2023-10-27 2434 2348 2508
0.18.0 2023-10-21 2283 2395
0.17.0 2023-09-19 2178 2368
0.16.0 2023-08-26 2053 1978
0.15.0 2023-08-13 2039 2098
0.14.1 2023-07-30 1670
0.13.0 2022-11-25 1637 1773
0.11.0 2022-09-18 1477
0.10.0 2022-05-09 1426
0.9.0 2021-11-29 1449
0.6.0 2021-10-19 1263
0.4.0 2021-09-20 1208

* Not enough games

0 CCRL Blitz elo estimation, based on 40+0.4 gauntlets vs other engines

1 After 2024-01-13 CCRL blitz elo recalculation, where Lynx 1.0.1 went from 2497 to 2432

Building Lynx

Lynx release artifacts are self-contained and require no dependencies to be run.

However, you can also choose to build Lynx yourself.

Requirements

  • .NET 9 SDK. You can find instructions about how to install it in your preferred OS/Distro either here or here.

If you're a Linux user and are new to .NET ecosystem, the conversation in this issue may help.

Instructions

  • Clone the repo and preferably checkout one of the tagged commits.

  • Run make to build a self-contained binary similar to the pre-compiled ones.

    Disclaimer: I do not use the Makefile myself, which means it is not fully tested and may occasionally get out of date.

  • Alternatively, you can get the exact dotnet publish (...) command from release.yml that is used by the CI to create the binaries and run it yourself (with the right runtime identifier).

    Examples:

    dotnet publish src/Lynx.Cli/Lynx.Cli.csproj -c Release --runtime linux-x64 --self-contained /p:Optimized=true -o /home/your_user/engines/Lynx
    dotnet publish src/Lynx.Cli/Lynx.Cli.csproj -c Release --runtime win-x64 --self-contained /p:Optimized=true -o C:/Users/your_user/engines/Lynx
  • The previous steps will generate an executable named Lynx.Cli(.exe) and a settings file named appsettings.json, which are enough to run Lynx chess engine.

Features

Feature list

Beware, most of the provided links contain outdated information and don't reflect the current implementation or the state of the art of computer chess programming, at this point they remain here mostly for historical reasons.

Search

  • NegaMax [1]

  • Quiescence Search [1]

  • Iterative Deepening Depth-First Search (IDDFS) [1] [2]

  • Aspiration Windows [1] [2]

  • Principal Variation Search (PVS) [1]

  • Null-move pruning (NMP) [1] [2]

  • Late Move Pruning (LMP)

  • Futility Pruning (FP)

  • Reverse Futility Pruning (RFP)

  • History pruning

  • Late Move Reductions (LMR) [1] [2] [3]

  • Internal Iterative Reduction (IIR)

  • Check extensions [1]

  • Static Exchange Evaluation (SEE) for move ordering, reduction and QSearch pruning

  • Razoring [1]

  • Killer heuristic [1]

  • History heuristic: quiet history, capture history, continuation history, history malus [1]

  • Countermoves

Evaluation

  • Piece-Square Tables (PSQT) [1]

  • King-bucketed PSQT

  • Enemy king PSQT

  • Mobility (knight, bishop, rook, queen)

  • Bishop pair

  • Bishop penalty for same color pawns

  • Bishop penalty for blocked central pawns

  • Rook in open and semi-open files

  • King pawn shield, king virtual mobility, king in open and semi-open files

  • Isolated pawns

  • Passed pawns, including bonus for not opponent pieces ahead and friend/opponent king distance to it

  • Pawn phalanx

  • Pieces protected and attacked by pawns

  • Pieces capable of deliverying checks

  • Eval scaling with pawn count and 50 moves rule

  • 50 moves rule eval scaling

Miscellaneous

  • PEXT Bitboards [1] [2]

  • Zobrist hashing [1]

  • Transposition Table [1]

  • Triangular PV-Table [1]

  • Most Valuable Victim - Least Valuable Aggressor (MVV-LVA) [1]

  • Incremental move sorting

  • Hard/Soft time management

  • Expected moves to go [1]

Credits

Lynx development would simply not have been possible without:

I would also like to extend my gratitude to:

  • Engine Programming discord group. Without it, Lynx wouldn't be as strong as it is nowadays. Especial mention for Jamie Whiting (Akimbo), Antares (Altair), Ciekce (Stormphrax), Rak (Mess), AspectOfTheNoob (Sirius), etc.

  • The community Discord around SebLague/Chess-Challenge, which allowed me to discover EP discord and to revisit the basics, this time explained by very knowledgeable developers (such as the ones above) to people without any previous chess engine programming knowledge

  • Marcel Vanthoor and his blog about how he created his engine, Rustic

  • Gedas for his texel-tuner tool

  • SF developers for their WDL_model tool

  • Andrew Grant for OpenBench

  • lichess developers for lichess-bot

  • Open source chess engines with permissive licenses. Their existence encourages knowledge sharing and really helps pushing the Chess Engine Developer community forward. Some engines are credited inside the codebase itself, where relevant

  • Countless other developers and online resources, who/which I should probably remember, but don't come to my mind right now

Thanks also to all the testers that invest their time in computer chess, especially those ones that test lower rated engines (as opposed to only top ones).