-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from SzilBalazs/v1-prep
V1 preparation
- Loading branch information
Showing
10 changed files
with
345 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,89 @@ | ||
name: Perft test and benchmark | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: [ "master" , "dev"] | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
BlackCore: | ||
name: ${{matrix.config.name}} | ||
runs-on: ${{matrix.config.os}} | ||
strategy: | ||
matrix: | ||
config: | ||
- { | ||
name: "Ubuntu g++ popcnt", | ||
os: ubuntu-latest, | ||
compiler: g++-11, | ||
arch: popcnt, | ||
target: BlackCore-popcnt-linux, | ||
upload_target: true, | ||
} | ||
- { | ||
name: "Ubuntu g++ modern", | ||
os: ubuntu-latest, | ||
compiler: g++-11, | ||
arch: modern, | ||
target: BlackCore-modern-linux, | ||
upload_target: true, | ||
} | ||
- { | ||
name: "Ubuntu g++ bmi2", | ||
os: ubuntu-latest, | ||
compiler: g++-11, | ||
arch: bmi2, | ||
target: BlackCore-bmi2-linux, | ||
upload_target: true, | ||
} | ||
- { | ||
name: "Windows g++ popcnt", | ||
os: windows-latest, | ||
compiler: g++, | ||
arch: popcnt, | ||
target: BlackCore-popcnt-win.exe, | ||
upload_target: true, | ||
} | ||
- { | ||
name: "Windows g++ modern", | ||
os: windows-latest, | ||
compiler: g++, | ||
arch: popcnt, | ||
target: BlackCore-modern-win.exe, | ||
upload_target: true, | ||
} | ||
- { | ||
name: "Windows g++ bmi2", | ||
os: windows-latest, | ||
compiler: g++, | ||
arch: bmi2, | ||
target: BlackCore-bmi2-win.exe, | ||
upload_target: true, | ||
} | ||
|
||
steps: | ||
- name: Updating g++ | ||
run: | | ||
sudo apt-get update | ||
sudo apt install g++-10 | ||
g++ --version | ||
make --version | ||
- uses: actions/checkout@v3 | ||
- name: Making BlackCore | ||
run: | ||
make -C src CXX=g++-10 | ||
- name: Running perft test | ||
run: | ||
make -C src perft CXX=g++10 | ||
- name: Running benchmark | ||
run: | ||
make -C src bench CXX=g++10 | ||
- uses: actions/checkout@v3 | ||
- name: Installing packages | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install g++-11 | ||
- name: Making BlackCore | ||
run: | | ||
cd src | ||
make CXX=${{matrix.config.compiler}} EXE=${{matrix.config.target}} ARCH=${{matrix.config.target}} | ||
- name: Running perft | ||
run: | | ||
cd src | ||
./${{matrix.config.target}} perft | ||
- name: Running bench | ||
run: | | ||
cd src | ||
./${{matrix.config.target}} bench | ||
- name: Upload artifact | ||
if: ${{matrix.config.upload_target}} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: BlackCore | ||
path: src/${{matrix.config.target}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
<h1 align="center">BlackCore</h1> | ||
<div align="center"> | ||
<img src="https://github.com/SzilBalazs/BlackCore/actions/workflows/build.yml/badge.svg" alt="Test status"> | ||
</div> | ||
|
||
## Overview | ||
|
||
BlackCore is a UCI compatible c++ chess engine written from scratch, capable of completing high performance tasks. | ||
Its alpha beta search uses various pruning techniques, powered by a handcrafted evaluation function and a blazing fast | ||
move generator. | ||
|
||
## Files | ||
|
||
This project contains the following files: | ||
|
||
- **README.md** the file that you are reading. | ||
- **LICENSE** containing the license of this repository. | ||
- **.github** folder contains automated GitHub workflows like building this project. | ||
- **src** folder contains the source code of BlackCore | ||
|
||
## Features | ||
|
||
* UCI support | ||
* Perft test | ||
* Up to ~230M nps | ||
* Intel i3-7100 3.9Ghz CPU | ||
* Single-threaded | ||
* Hashing disabled | ||
* Benchmark | ||
* Fixed depth search on a set of custom positions | ||
* 16 bit encoded moves | ||
* Bitboard representation | ||
* Engine | ||
* Search | ||
* Iterative deepening | ||
* Alpha-Beta | ||
* Negamax | ||
* Transposition table | ||
* Cut-offs | ||
* Entry aging | ||
* Bucket system | ||
* 1 always replace | ||
* 1 depth preferred | ||
* Principal variation search | ||
* Late move pruning | ||
* R = LMR_BASE + (sqrt(index - 1) + sqrt(depth - 1)) / LMR_SCALE | ||
* Razoring | ||
* Dropping into qsearch at frontier nodes | ||
* Reverse futility pruning | ||
* With improving detection | ||
* Null move pruning | ||
* Reduction depends on depth searched | ||
* Quintessence search | ||
* Stand-pat | ||
* Delta pruning | ||
* Static-exchange-evaluation pruning | ||
* Move ordering | ||
* Hash move | ||
* Promotions | ||
* Under promotions | ||
* Captures | ||
* MVV-LVA | ||
* SEE - currently disabled | ||
* Quiet moves | ||
* Killer heuristic | ||
* History heuristic | ||
* Fast repetition detection | ||
* Time management | ||
* Sudden death | ||
* Increment per move | ||
* Move-time | ||
* Moves to go support | ||
* Handcrafted evaluation | ||
* Tapered eval | ||
* Mid-game and end-game | ||
* Material balance | ||
* Pawn structure | ||
* Double pawns | ||
* Isolated pawns | ||
* Passed pawns | ||
* King safety | ||
* Pawn king shield | ||
* Bonus for castled king | ||
* Trapped rooks restricted by uncastled king | ||
* Knight mobility | ||
* Restricted by enemy pawns | ||
* Bishop mobility | ||
* Depending on the pawn structure | ||
* Rooks | ||
* Mobility | ||
* Bonuses for open and half open files | ||
* Tempo | ||
|
||
## Installation | ||
|
||
### Building from source | ||
|
||
After downloading the sources (preferably the source of the latest release) you can run the following commands, to build | ||
a native binary. | ||
BlackCore uses c++20 standard, so older versions of compilers might not work. | ||
|
||
``` | ||
cd src | ||
make clean build CXX=g++-11 ARCH=native | ||
``` | ||
|
||
ARCH = popcnt/modern/bmi2/native | ||
|
||
CXX = the compiler of your choice (I recommend using g++, as it gives the best performance) | ||
|
||
### Downloading prebuilt binary | ||
|
||
You can download the latest release <a href="https://github.com/SzilBalazs/BlackCore/releases/latest">here</a> both for | ||
Windows and Linux. | ||
To select the right binary, choose the bmi2 build if you have a fairly new CPU, otherwise you can use the modern build | ||
or in case of an older | ||
processor use the popcnt build. Only 64 bits CPUs with popcnt are supported at the moment. | ||
|
||
## Usage | ||
|
||
BlackCore in itself is a command line program, and requires a UCI compatible | ||
Chess GUI (like <a href="https://github.com/cutechess/cutechess">Cute Chess</a> | ||
or <a href="http://www.playwitharena.de/">Arena</a>) for the best user experience. | ||
|
||
### UCI Options | ||
|
||
- **Hash** - The size of the Hash table in MB. | ||
- **Threads** - Currently BlackCore only supports single threaded search, but this will probably change in the future. | ||
- **Move Overhead** - The delay (in ms) between finding the best move and the GUI reacting to it. You may want to make | ||
this | ||
higher if you notice that the engine often runs out of time. | ||
|
||
## Big thanks to | ||
|
||
### <a href="https://www.chessprogramming.org/Main_Page">Chess Programming Wiki</a> | ||
|
||
The Chess Programming Wiki is the greatest | ||
resource for everybody who wants to be informed about the basics and the state-of-the-art technologies of chess | ||
programming. | ||
|
||
### <a href="https://github.com/AndyGrant/OpenBench">OpenBench</a> by Andrew Grant | ||
|
||
OpenBench is an usefull SPRT testing framework, which contributed | ||
to the development of BlackCore substantially. | ||
|
||
### <a href="https://github.com/official-stockfish/Stockfish">StockFish</a> by The StockFish team | ||
|
||
Thanks to the StockFish team for making such a wonderful and an easy-to-read codebase, that inspired me to get into | ||
chess programming in the first place. | ||
|
||
### <a href="https://github.com/Disservin/Smallbrain">Smallbrain</a> by <a href="https://github.com/Disservin">Disservin</a> | ||
|
||
Smallbrain is a great chess engine which helped me understand many important concepts, and thanks to Disservin for | ||
giving me many great ideas how can I further improve my engine. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.