Skip to content

Latest commit

 

History

History
83 lines (57 loc) · 2.43 KB

README.md

File metadata and controls

83 lines (57 loc) · 2.43 KB

Banner

Chess Snapshot API

The Chess Snapshot API provides an easy-to-use RESTful interface for detecting and analyzing chess positions from images. It utilizes the Chess Position Detector to convert a chessboard image into a FEN string and integrates the powerful Stockfish chess engine to determine the best move from any given position.

This API is intended for integration with a Flutter application, offering seamless support for the Chess Snapshot App.

Installation

Prerequisites

Requirements

Ensure that Python is installed on your machine. You can install the necessary dependencies using pip and the requirements.txt file.

pip install -r requirements.txt

Dependencies

  • OpenCV
  • Numpy
  • Flask
  • Stockfish
  • ...

These dependencies are necessary for image processing, detection algorithms, and chess analysis.

Usage

To use the Chess Snapshot API, follow these steps:

  1. Start the Flask Server:

    python app.py
  2. Expose the Server with Ngrok:

    ngrok http --domain=knowing-fit-poodle.ngrok-free.app 8080

Endpoints

  1. Get Chess Position (FEN String)

    • URL: /api/get_chess_position
    • Method: POST
    • Description: This endpoint accepts an image file of a chessboard and returns the FEN string representing the position on the board.
    • Response Example:
      {
        "fen": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR"
      }
  2. Get Best Move

    • URL: /api/get_best_move
    • Method: POST
    • Description: This endpoint accepts a FEN string and returns the best move as calculated by Stockfish.
    • Response Example:
      {
        "best_move": "e2e4"
      }

Acknowledgments

This project is based on advanced computer vision techniques and was supervised by Lect. Dr. Ioana Cristina Plajer.

Read More: Chess Snapshot Full Documentation in Romanian (PDF)

Additional Resources