MarcoEngine is an interesting neural chess network that uses a self-learning method (achieving a good game by trying out mistakes).
- Working only on Linux;
- Python 3.10 or newer requied.
First, install the required libraries:
pip install -r requirements.txt
Set your another UCI engine in config.py in ENGINE_DIR.
Wait for the modules to be installed. Now, you need to set the weights. You can find out more about this in the Where I can download weights? section.
To run the engine, you must have weights. If you don't have weights, you can create a weights_norm.json
file in the weights folder. After that, go to the main directory of the project, then write the command:
python3 train.py
After that, wait the amount of time you need, and turn off the program. Congratulations! You now have a working MarcoEngine in your hands. Time to test it. The engine supports a small part of the UCI protocol, but this is enough. To start the UCI shell:
python3 uci.py
If you need to compile the engine, you can use the build.sh file. Just type in terminal:
bash build.sh
Then wait, and everything will be ready.
IMPORTANT!!! The compilation is not yet fully tested, and there may be interruptions in work, for which we apologize ...
You can get the weights in two ways:
1. Method 3: Download from one of the releases of MarcoEngine (they will be in this repository), then transfer the weights file to the (not supported now)weights
folder. Next, read the text under the heading Start engine to understand how to start the engine.
2. Method 2: Train a neural network on a computer. If you want to generate weights directly on your computer, you can enter the command:
python3 train.py
Then wait some time for the training program to reach at least the first stage of weights. You can either continue the program to train, or just turn it off. After that, your path lies in the Start engine header, where you will be shown how to start the engine.
3. Method 3: Use a special utility to quickly generate weights. After the end of the generation, place the .json files in the weights folder.
Marco Engine is a completely different engine from other chess neural networks. It doesn't use any neurons, synapses, or anything like that. This engine is very simple, from its side, when the program starts, it looks like this:
-
Playing with yourself, writing the game in something like the PGN format, but in .json:
{"move": "board fen"}
. After the game, it writes to the results.json file (which is in thegames
directory) it writes the result of the game. -
After that, it starts in a loop through the keys of the json dictionary in which the game is recorded. He analyzes the positions, and then reveals whether that move was a good one or not. If it is good, it writes a move to the json dictionary, and the iteration starts again. Otherwise - it starts analyzes the position more and more deeply, trying to find a new move. After finding a new move, he compares the estimates, after which he already receives an answer - is the new move good or not. Here I think it's understandable, he writes down this move in the weights, and the iteration starts again.
Very simple, but very productive. We improve our neural network almost every day, we hope that something good will come out.
Command | go | uciok(AKA: uci) | ucinewgame | position fen [fen] | position startpos moves [moves] | isready | quit |
---|---|---|---|---|---|---|---|
About | Analyzing position | Gives about UCI settings | Starts new game with new board | Creates new board with inputed fen | Sets moves to new board | Hey! MEngine, you ready? | Exit from MarcoEngine |