MORA CHESS ENGINE
Being a software engineering student, I found myself struggling to come with an idea for my final project. I love to play chess and I love to code. So one day while I was reading about AlphaZero I started to wonder how difficult could it be to write my own chess engine. After a while I realized that, being challenging enough, writing a chess engine was a feasible project within 6 months. So I presented the idea to my project director and started to work.
The main goal was for my engine to reach 2000 ELO in the Computer Chess Rating Lists. After a lot of hard work, I think (based on some experiments) MORA CHESS ENGINE is in the 2100-2200 range.
I've provided binaries for both Windows and Linux. Still, if you want to compile the sources yourself you can use g++ compiler with the following commands:
g++ -std=c++11 -O3 -pthread attacks.cpp bitboards.cpp evaluation.cpp main.cpp move.cpp movegenerator.cpp pawnhashtable.cpp position.cpp search.cpp timemanagement.cpp transpositiontable.cpp uci.cpp -o MORA
g++ -std=c++11 -O3 attacks.cpp bitboards.cpp evaluation.cpp main.cpp move.cpp movegenerator.cpp pawnhashtable.cpp position.cpp search.cpp timemanagement.cpp transpositiontable.cpp uci.cpp -o MORA
-O3 flag to turn on all the optimizations of the compiler.
MORA CHESS ENGINE supports the UCI Protocol, so you can use any GUI that implements UCI to try the engine. I use Arena Chess GUI, which you can download for free.
In Arena you can install a new engine like this:
- Go to Engines/Install New Engine...
- Select the binary corresponding to your platform.
- Go to Engines/Manage...
- Select UCI where it says type (if it was not recognized from the beginning)
- You should also go to Books in the previous menu and select the <Use Arena mainbooks with this engine> option (MCE doesn't implement its own opening book).
MORA CHESS ENGINE is available for both Windows and Linux. You can download the binaries from here.
Note: The sources are pretty much the same, but for the moment Windows's version doesn't implement stop/quit UCI commands to interrupt a search. In the future maybe I will add a cross platform thread library (like Boost) to unify both versions.
Here is a summary of the features implemented in MORA CHESS ENGINE.
- Redundant 8x8 Mailbox
- Plain Magic Bitboards
- Iterative Deepening
- Alpha Beta
- Transposition Tables
- Check Extension
- PVS Search
- Null Move Pruning
- Late Move Reductions
- Move Ordering
- PV Move
- Captures ordered by MVVLVA
- Killer Moves
- History Heuristic
- Quiescence Search
- Delta Pruning
- Captures and Promotions Move Generator
- Check Evasion (without special generator)
- Piece-Square Tables
- Piece Evaluation
- Pawn Structure
- Isolated Pawns
- Doubled Pawns
- Backward Pawns
- Passed Pawns
- King Safety
- Pawn Shelter
- Pawn Storms
- Open Files next to the King
- Enemy Queen Attacks
- Tempo bonus
- UCI (not every command)
MORA CHESS ENGINE is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
MORA CHESS ENGINE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
- Chess Programming Wiki
- Bluefever Software - Video Tutorial Series: Programming a Chess Engine in C
- Computer Chess Club
- Computer Chess Rating Lists
- Robert Hyatt
- Bruce Moreland
And special thanks to my project director: Luciano H. Tamargo, who from the very first moment embrace my idea of writing a chess engine and kept me always motivated.