user33659: How do I get the color the engine should play? My minimax function requires color to return the best move for that color. I'm using uci protocol, but I'm looking at the docs and cannot find anything that mentions color.

user30545: The engine receives a position command.
Example 1:
position startpos

In startpos, the side to move is white.
The startpos is just equal to a fen:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
This is equivalent to:
position fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1

Example 2:
position fen rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1

The b before KQkq is the side to move. That means it is black.
Example 3:
position startpos moves e2e4

The side to move is black because from startpos there is a white move e2e4.
Example 4:
position fen rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1 moves c7c5 g1f3 d7d6

The side to move is white.
References

https://github.com/fsmosca/UCIChessEngineProtocol
https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation


33659: <p>How do I get the color the engine should play? My minimax function requires color to return the best move for that color. I'm using uci protocol, but I'm looking at the docs and cannot find anything that mentions color.</p>
 30545: <p>The engine receives a position command.</p>
<h4>Example 1:</h4>
<pre><code>position startpos
</code></pre>
<p>In startpos, the side to move is white.<br />
The startpos is just equal to a fen:<br />
<code>rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1</code><br />
This is equivalent to:</p>
<pre><code>position fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
</code></pre>
<h4>Example 2:</h4>
<pre><code>position fen rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1
</code></pre>
<p>The <strong>b</strong> before KQkq is the side to move. That means it is black.</p>
<h4>Example 3:</h4>
<pre><code>position startpos moves e2e4
</code></pre>
<p>The side to move is <strong>black</strong> because from startpos there is a white move e2e4.</p>
<h4>Example 4:</h4>
<pre><code>position fen rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1 moves c7c5 g1f3 d7d6
</code></pre>
<p>The side to move is white.</p>
<h3>References</h3>
<ul>
<li><a href="https://github.com/fsmosca/UCIChessEngineProtocol" rel="nofollow noreferrer">https://github.com/fsmosca/UCIChessEngineProtocol</a></li>
<li><a href="https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation</a></li>
</ul>
