Code Monkey home page Code Monkey logo

marcoengine's Introduction

forthebadge made-with-python

by mN! its uci :)

Python

Linux macOS

MarcoEngine is an interesting neural chess network that uses a self-learning method (achieving a good game by trying out mistakes).

⚠️ Notes

  • Working only on Linux;
  • Python 3.10 or newer requied.

↓ Installation

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.

🚗 Start engine

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

🏗️ I want to build engine

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 ...

🖥️ Where I can download weights?

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 weights folder. Next, read the text under the heading Start engine to understand how to start the engine.(not supported now)

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.

⚙️ How does Marco Engine work?

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:

  1. 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 the games directory) it writes the result of the game.

  2. 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.

📝 MarcoEngine UCI-protocol

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

📩 Contact us!

marcoengine's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

marcoengine's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.