Skip to content

REST API server to receive remotely tasks for chess analysis with queue and ETA prediction

License

Notifications You must be signed in to change notification settings

Scorpibear/remote-chess-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Remote Chess Engine

Build Status Coverage Status npm version

Remote Chess Engine, ready to process position analysis tasks via Remote Interface for Chess Positions Analysis (RICPA)

Install

npm i -g remote-chess-engine

Configure

create config/local.json with the following properties, setting valid path and values, e.g.: for windows OS:

{
  "pathToEngine": "stockfish_9_x64.exe",
  "uciOptions": [{"name":"Threads", "value":3}, {"name": "Hash", "value": 4096}],
  "port": 9977,
  "evaluationsFile": "evaluations.json",
  "queueFile": "queue.json",
  "historyFile": "history.json"
}

for unix-like OS:

{
  "pathToEngine": "/home/rceuser/stockfish/stockfish",
  "uciOptions": [{"name":"Threads", "value":2}, {"name": "Hash", "value": 6912}, {"name": "SyzygyPath", "value": "/media/syzygy"}],
  "port": 9977,
  "evaluationsFile": "evaluations.json",
  "queueFile": "queue.json",
  "historyFile": "history.json"
}

make sure pathToEngine refered to existent binaries and is an absolute path (no ~/ stuff allowed) and uciOptions are valid for you server. Evaluations, queue and history files could be absent - will be created automatically.

Run

remote-chess-engine

or for background execution

remote-chess-engine &> rce.log &

with

tail -f rce.log

to check log at runtime

API

GET /fen: input - fen, depth. Returns bestMove for this fen and depth or placeInQueue and estimatedTime when answer could be provided. If fen is not analyzed and is not in queue, returns {bestMove: underfined, placeInQueue: undefined, estimatedTime: underfined}

POST /fen - posts fen for analysis with specified depth at the end of a queue, triggers analysis from the top of queue if nothing is being analyzed now

  • fen - FEN of chess position
  • depth - depth to analyze
  • pingUrl - url to execute get call when analysis finished
  • returns place in queue starting from 0 and estimated time to analyze ({placeInQueue, estimatedTime})

DELETE /fen - delete specified fen from the queue. Input - fen.

GET /queue - gets queue as [{fen, depth, estimatedTime}, ...]

About

REST API server to receive remotely tasks for chess analysis with queue and ETA prediction

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •