Skip to content

Commit 3985faf

Browse files
UndefinedCppUndefinedCpp
authored andcommitted
initial commit
0 parents  commit 3985faf

21 files changed

+7841
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Emerald Chess Engine
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Overview
2+
3+
This is a toy chess engine I developed over two weeks as part of my winter break project. It is **UCI-compatible**, and plays roughly at the level of **1600 Elo** (unofficial; tested on my laptop, TC 10+0.1).
4+
5+
This software **does not** come with a GUI, so if you want to play it you will need to download one from Internet. I recommend [en-croissant](https://github.com/franciscoBSalgueiro/en-croissant).
6+
7+
This engine is still **WIP** and will be updated from time to time, though I do not currently have any plans for updating.
8+
9+
## Compiling
10+
11+
I currently have a small build script that compiles the engine with `g++` (`build.py`). Why, you may ask, don't you use `Makefile`? Because I don't know how to use it yet... (What a shame) I will probably move to `Makefile` in the future.
12+
13+
Nevertheless, I have compiled the binary for Windows and you can find it in the release page.
14+
15+
## License
16+
17+
This project is licensed under the MIT License.
18+
19+
## Acknowledgements
20+
21+
During the development, I have referred to and learned from a lot of resources, including:
22+
23+
- [Stockfish](https://github.com/official-stockfish/Stockfish/tree/master) source code (and its previous versions)
24+
- [Stockfish Evaluation Guide](https://hxim.github.io/Stockfish-Evaluation-Guide/) - thank you for this comprehensive interactive wiki!
25+
- Sebastian Lague's [Coding Adventure Bot](https://github.com/SebLague/Chess-Coding-Adventure/tree/Chess-V2-UCI) and his excellent [Youtube videos](https://www.youtube.com/watch?v=_vqlIPDR2TU) on chess programming!
26+
- [Chess Programming Wiki](https://www.chessprogramming.org/Main_Page/) - an amazing place to learn about every aspects of chess programming!
27+
- [Disservin](https://github.com/Disservin)'s [chess library](https://github.com/Disservin/chess-library) and his engine testing tool [fastchess](https://github.com/Disservin/fastchess)!
28+

build.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import os
2+
import argparse
3+
import subprocess
4+
5+
parser = argparse.ArgumentParser(description='Build the project')
6+
parser.add_argument('--optimize', '-O', action='store_true',
7+
help='Optimize the build', default=True)
8+
parser.add_argument('--arch', '-a', type=str, default='native')
9+
parser.add_argument('--target', type=str, default='engine.exe')
10+
parser.add_argument('--run', '-r', action='store_true',
11+
help='Run the program after building', default=False)
12+
parser.add_argument('--static', action='store_true')
13+
parser.add_argument('--iterative', action='store_true')
14+
15+
SOURCE_DIR = './src'
16+
17+
if __name__ == '__main__':
18+
args = parser.parse_args()
19+
20+
source_files = []
21+
for filename in os.listdir(SOURCE_DIR):
22+
if filename.endswith('.c') or filename.endswith('.cpp'):
23+
source_files.append(os.path.join(SOURCE_DIR, filename))
24+
25+
if args.iterative:
26+
if os.path.exists('./build/engine.old.exe'):
27+
os.remove('./build/engine.old.exe')
28+
if os.path.exists('./build/engine.exe'):
29+
os.rename('./build/engine.exe', './build/engine.old.exe')
30+
31+
command = [
32+
'g++',
33+
'-O3' if args.optimize else '',
34+
*source_files,
35+
'-Wall',
36+
'-std=c++17',
37+
f'-march={args.arch}',
38+
'-o',
39+
f'./build/{args.target}',
40+
]
41+
if args.static:
42+
command.extend([
43+
'-static-libstdc++',
44+
'-static-libgcc',
45+
'-static'
46+
])
47+
48+
print(f'Executing {" ".join(command)}')
49+
ret = subprocess.run(command).returncode
50+
print('Build finished with code {}'.format(ret))
51+
52+
if args.run and (ret == 0):
53+
print('== Engine', '=' * 70)
54+
ret = subprocess.run(['./build/engine.exe']).returncode
55+
print('=' * 80)
56+
print('Program finished with code {}'.format(ret))

log.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Improvements and Changes
2+
3+
## Roadmap
4+
5+
This section describes the general things to implement.
6+
7+
### Search
8+
9+
- [x] **negamax** with alpha-beta pruning
10+
- [x] **quiescence search**
11+
- [x] **iterative deepening** framework
12+
- [x] **null move pruning**
13+
- [x] **killer moves**
14+
- [x] **MVV/LVA** move ordering
15+
- [x] **transposition table**
16+
- [ ] **late move reductions**
17+
- [ ] **futility pruning**
18+
19+
### Evaluation
20+
21+
**Part 1** HCE
22+
23+
- [x] **piece** value
24+
- [x] **mobility**
25+
- [ ] **king safety**
26+
- [ ] passed **pawns**
27+
- [ ] **pawn** structure
28+
- [ ] **threats**
29+
- [x] **space**
30+
31+
**Part 2** NNUE transition
32+
33+
- [ ] **NNUE** data generation
34+
- [ ] **NNUE** training
35+
- [ ] **NNUE** evaluation support
36+
37+
### Engine
38+
39+
- [ ] **opening book**
40+
- [x] basic **UCI** support
41+
- [ ] **options**
42+
- [ ] **syzygy** endgame tablebase

0 commit comments

Comments
 (0)