A local web service for analyzing chess positions using the Stockfish engine.
The project is a Flask application that takes chess positions in FEN format and returns the best move, position evaluation, and principal variations (PV) using the popular chess engine Stockfish.
- Python 3
flaskchess(python-chess)
- Install the required dependencies:
pip install flask chess
- Download the Stockfish engine and place the executable file (
stockfish.exe) in the root directory of the project. - Start the server:
python app.py
- Open your browser and go to
http://localhost:5000
Send a POST request to /calculate with JSON data:
{
"fen": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
"time": 1.0
}Response:
{
"best_move": "e2e4",
"score": "+0.45",
"pv": "e2e4 e7e5 g1f3 b8c6"
}Локальный веб-сервис для анализа шахматных позиций на базе движка Stockfish.
Проект представляет собой Flask-приложение, которое принимает шахматные позиции в формате FEN и возвращает лучший ход, оценку позиции и основные варианты (PV), используя популярный шахматный движок Stockfish.
- Python 3
flaskchess(python-chess)
- Установите необходимые зависимости:
pip install flask chess
- Скачайте движок Stockfish и поместите исполняемый файл (
stockfish.exe) в корневую папку проекта. - Запустите сервер:
python app.py
- Откройте в браузере
http://localhost:5000
Отправьте POST-запрос на /calculate с JSON-данными:
{
"fen": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
"time": 1.0
}Ответ:
{
"best_move": "e2e4",
"score": "+0.45",
"pv": "e2e4 e7e5 g1f3 b8c6"
}