Posts

Showing posts from 2018

Running Stockfish hosted in Azure function

Image
While working on small chess application had an idea to integrate Stockfish engine, so it will be possible to play with engine.
More about Stockfish here : https://stockfishchess.org/
and here https://github.com/mcostalba/Stockfish

The idea is to pass FEN and Depth for calculation to some API which will suggest the best move.
My main problem is that the goal is to host engine in Azure, as function written in C# while Stockfish is in C++. There are of course some .net ports but really outdated and did not want to experiment with them.

First step is just to clone git repo of Stockfish and build exe file, put it into separate folder in my solution. Stockfish is a command line tool. I will send the commands to console and read the output.

This is what I will send and get:


And in the solution it will look like this:

With "No build" and "Copy to output" options

The function by itself to get the request is pretty simple:
[FunctionName("stockfish")]
        public stat…