An attempt to evolve a chess engine tuning chess evaluation functions evolved by Neuroevolution frameworks (CoSyNE and NEAT).
Three architectures had been evolved for 200 generations:
- CoSyNE-based fixed topology: 1 hidden layer architecture
n = {64, 128, 1}. - CoSyNE-based fixed topology: 2 hidden layer architectures
n = {64, 64, 64, 1}. - NEAT-based varying network topology: 1 hidden layer architecture
n = {64, 128, 1}.
The project is still under development: Neuroevolved virtual players have partially learned the optimization task and more work is needed in order to have them fully able to play properly.
Report available at: report
- Install all required libraries in a dedicated python 3.10 environment by:
pip install -r requirements.txt. - Download and install a Stockfish executable chess engine in your local machine: (https://stockfishchess.org/).
- Choose the
PAST_GENgeneration to be tested by modifying the global var. - Adapt the
STOCKFISH_PATHglobal var pointing at to your local Stockfish file intest_*.pyand files if you want to test the engine against Stockfish: results will be saved in/evaluation/stockfish_eval.csvif playing with_1hiddor_2hiddversions otherwise if you need to test NEAT based chess engine, runtest_dhn.py: results will be stored in/evaluation/stockfish_eval_neat.csv. You can run the testing procedure by specifying the number of the generation to be tested:
python test_1hidd.py 150Generations available: (25, 50, 75, 100, 125, 150, 175, 200).
- Adapt the
STOCKFISH_PATHglobal var pointing at to your local Stockfish file invisual_test.ipynband execute the codecell.
Currently, you can test only the 1 hidden layer architecture by specifying the PAST_GEN generation.
- Evolution procedure (multi-thread spawning matches to perform tournament between individual of the current population)
- Testing procedure (single-thread running due to Stockfish limitation)
- Evolving NEAT virtual players by enforcing elitims (currently disabled)
- Visual assessment of 2-hidden layers architecture and NEAT chess based engine
- Re-implementing the engine (further implementations improvements to be defined for better performance)
- Disservin: python chess engine (GNU GPL-3.0 Licence) (https://github.com/Disservin/python-chess-engine/tree/master)
- Ilya Zhelyabuzhsky: Stockfish python API (MIT Licence) (https://github.com/zhelyabuzhsky/stockfish/tree/master)
- Official Stockfish (GNU GPL-3.0 Licence): (https://github.com/official-stockfish/Stockfish)
- Python 3.10
- Ubuntu 22.04 LTS
- Stockfish v.16