perplexity-cli
🧠 A simple command-line client for the Perplexity API. Ask questions and receive answers directly from the terminal! 🚀🚀🚀
Strong chess engine
git clone https://github.com/Witek902/Caissa.gitWitek902/Caissa(image generated with DALL·E 2)
Caissa is a strong, UCI-compatible chess engine written from scratch in C++ since early 2021. It features a custom neural network evaluation system trained on over 17 billion self-play positions, achieving ratings of 3600+ ELO on major chess engine rating lists, placing it at around top-10 spot.
The engine is optimized for:
Caissa consistently ranks among the top chess engines on major rating lists:
| List | Rating | Rank | Version | Notes |
|---|---|---|---|---|
| CCRL 40/2 FRC | 4027 | #8 | 1.24 | Fischer Random Chess |
| CCRL Chess324 | 3770 | #6 | 1.23 | Chess324 variant |
| CCRL 40/15 | 3623 | #13 | 1.23 | 4 CPU |
| CCRL Blitz | 3752 | #10 | 1.22 | 8 CPU |
| List | Rating | Rank | Version |
|---|---|---|---|
| SPCC UHO-Top15 | 3700 | #13 | Caissa 1.25 avx512 |
| List | Rating | Rank | Version | Architecture |
|---|---|---|---|---|
| 10+1 (R9-7945HX) | 3532 | #18 | 1.25 | AVX-512 |
| 10+1 (i9-13700H) | 3546 | #16 | 1.25 | AVX-512 |
| List | Rating | Rank | Version |
|---|---|---|---|
| CEGT 40/20 | 3570 | #12 | 1.25 |
| CEGT 40/4 | 3614 | #8 | 1.22 |
| CEGT 5+3 | 3618 | #5 | 1.22 |
Note: The rankings above may be outdated.
libnuma)See the Compilation section below for detailed build instructions.
cd src make -j$(nproc)
Note: This compiles the default AVX2/BMI2 version.
mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Final .. make -j$(nproc)
Build Configurations:
Final - Production build, no asserts, maximum optimizationsRelease - Development build with asserts, optimizations enabledDebug - Development build with asserts, optimizations disabledArchitecture Selection:
To build for a specific architecture, set the TARGET_ARCH variable:
# AVX-512 (requires AVX-512 support) cmake -DTARGET_ARCH=x64-avx512 -DCMAKE_BUILD_TYPE=Final .. # BMI2 (recommended for modern CPUs) cmake -DTARGET_ARCH=x64-bmi2 -DCMAKE_BUILD_TYPE=Final .. # AVX2 cmake -DTARGET_ARCH=x64-avx2 -DCMAKE_BUILD_TYPE=Final .. # SSE4-POPCNT cmake -DTARGET_ARCH=x64-sse4-popcnt -DCMAKE_BUILD_TYPE=Final .. # Legacy (fallback) cmake -DTARGET_ARCH=x64-legacy -DCMAKE_BUILD_TYPE=Final ..
GenerateVisualStudioSolution.bat to generate the Visual Studio solutionbuild_<arch>/caissa.sln in Visual Studio 2022Note: Visual Studio 2022 is the only tested version. CMake directly in Visual Studio has not been tested.
CMake supports two ARM targets via TARGET_ARCH:
mkdir build && cd build # Generic AArch64 (no NEON intrinsics) cmake -DTARGET_ARCH=aarch64 -DCMAKE_BUILD_TYPE=Final .. # AArch64 with NEON SIMD (recommended on modern ARM hardware) cmake -DTARGET_ARCH=aarch64-neon -DCMAKE_BUILD_TYPE=Final .. make -j$(nproc)
After compilation, copy the appropriate neural network file from data/neuralNets/ to:
build/bin/build\bin\x64\<Configuration>\| Variant | CPU Requirements | Performance | Recommended For |
|---|---|---|---|
| AVX-512 | AVX-512 instruction set | Fastest | Latest Intel Xeon, AMD EPYC |
| BMI2 | AVX2 + BMI2 | Fast | Most modern CPUs (2015+) |
| AVX2 | AVX2 instruction set | Fast | Intel Haswell, AMD Ryzen |
| POPCNT | SSE4.2 + POPCNT | Moderate | Older CPUs (2008-2014) |
| Legacy | x64 only | Slowest | Very old x64 CPUs |
Tip: If unsure, try BMI2 first. It's supported by most modern CPUs and offers excellent performance.
In addition to the standard UCI protocol, the engine supports these non-standard commands useful for development and debugging:
| Command | Description |
|---|---|
bench [depth] |
Run a benchmark / smoke test |
perft [depth] |
Count legal moves to a given depth (move generation test) |
eval |
Display evaluation of the current position |
print |
Pretty-print the current board |
scoremoves |
Show move ordering scores for the current position |
threats |
Show threat information for the current position |
ttinfo |
Print transposition table statistics |
ttprobe |
Probe the transposition table for the current position |
tbprobe |
Probe tablebases for the current position |
cacheprobe |
Probe the node cache for the current position |
printparams |
Print all tunable search/eval parameters (only with ENABLE_TUNING build flag) |
The engine supports the following UCI options:
.pnn)Caissa has been written from the ground up since early 2021. The development journey:
The engine's neural network has evolved significantly:
Runtime Evaluation: PackedNeuralNetwork.cpp
Network Trainer: NetworkTrainer.cpp, NeuralNetwork.cpp
Self-Play Generator: SelfPlay.cpp
The project is organized into three main modules:
src/
├── backend/ # Core engine library
│ ├── Search.* # Search algorithms
│ ├── Position.* # Position representation
│ ├── MoveGen.* # Move generation
│ ├── PackedNeuralNetwork.* # Neural network evaluation
│ ├── TranspositionTable.* # Position caching
│ └── ...
│
├── frontend/ # UCI interface executable
│ ├── Main.cpp # Entry point
│ └── UCI.* # UCI protocol implementation
│
└── utils/ # Development and training tools
├── NetworkTrainer.* # Neural network training
├── SelfPlay.* # Self-play game generation
├── Tests.* # Unit tests
└── ...
This project is licensed under the MIT License - see the LICENSE file for details.
Author: Michał Witanowski
Started: Early 2021
Language: C++20
License: MIT
more like this
🧠 A simple command-line client for the Perplexity API. Ask questions and receive answers directly from the terminal! 🚀🚀🚀
search projects, people, and tags