user7699: I am writing a C# 3D chess game in Unity. I am looking for a chess engine that can

Take in an FEN string 
Return the best move to make given this FEN
Check if the board given this FEN is in checkmate

Does anyone know of a chess engine that can do this, preferably in C#? I have tried Stockfish and other chess engines, but they all work from the command line. If anyone knows how I can program the game using an engine that works from the command line, that would also work. Thanks!

user825: Unfortunately, chess engine doesn't work like what you expect. In particular, there is no such thing as API in the chess engine world. That's because calculating a chess move takes time, and it'll be insane to block your function call until you can get the move.
Chess engine almost always do the works in its own thread or process. You might need to learn how to interact with a thread/process. You'll also need to learn UCI chess protocol. I don't think there is a wrapper for you, but maybe there is just that I don't know.
Stockfish is a C++ engine, so you might need to wrap it with a managed C++ layer for C#. There is a Stockfish port on C#, but it's not as good as the original. However, you don't even need a source code to do your works. You could also take a closed engine such as Houdini.
General steps:

Download a compiled binary (*.exe). It can be anything like Houdini, Komodo or Stockfish. You don't have to compile the source code yourself.
Use Process.Start in C# to start a process of the chess engine
Talk with the child process like here
Try to send a UCI message like this:


isready

The isready UCI command is like pinging the chess engine. You should hear something back if your implementation works. Please take a look at the UCI documentation, you'll find it on Google. Once you know your code works. Try this:

ucinewgame
go move time 1000

This gives the engine one second to make a move. You will get something like this:

bestmove e2e4 ponder e7e5


7699: <p>I am writing a C# 3D chess game in Unity. I am looking for a chess engine that can</p>

<ol>
<li>Take in an FEN string </li>
<li>Return the best move to make given this FEN</li>
<li>Check if the board given this FEN is in checkmate</li>
</ol>

<p>Does anyone know of a chess engine that can do this, preferably in C#? I have tried Stockfish and other chess engines, but they all work from the command line. If anyone knows how I can program the game using an engine that works from the command line, that would also work. Thanks!</p>
 825: <p>Unfortunately, chess engine doesn't work like what you expect. In particular, there is no such thing as API in the chess engine world. That's because calculating a chess move takes time, and it'll be insane to block your function call until you can get the move.</p>
<p>Chess engine almost always do the works in its own thread or process. You might need to learn how to interact with a thread/process. You'll also need to learn UCI chess protocol. I don't think there is a wrapper for you, but maybe there is just that I don't know.</p>
<p>Stockfish is a C++ engine, so you might need to wrap it with a managed C++ layer for C#. There is a <a href="https://github.com/bpfliegel/Portfish" rel="nofollow noreferrer">Stockfish port</a> on C#, but it's not as good as the original. However, you don't even need a source code to do your works. You could also take a closed engine such as Houdini.</p>
<p>General steps:</p>
<ol>
<li>Download a compiled binary (*.exe). It can be anything like Houdini, Komodo or Stockfish. You don't have to compile the source code yourself.</li>
<li>Use Process.Start in C# to start a process of the chess engine</li>
<li>Talk with the child process like <a href="https://stackoverflow.com/questions/528652/what-is-the-simplest-method-of-inter-process-communication-between-2-c-sharp-pro">here</a></li>
<li>Try to send a UCI message like this:</li>
</ol>
<blockquote>
<p>isready</p>
</blockquote>
<p>The isready UCI command is like pinging the chess engine. You should hear something back if your implementation works. Please take a look at the UCI documentation, you'll find it on Google. Once you know your code works. Try this:</p>
<blockquote>
<p>ucinewgame</p>
<p>go move time 1000</p>
</blockquote>
<p>This gives the engine one second to make a move. You will get something like this:</p>
<blockquote>
<p>bestmove e2e4 ponder e7e5</p>
</blockquote>
