Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-20T15:12:19.910Z
Answers.Text: Super helpful! But how do I know which color my engine has been assigned to?
Answers.UserDisplayName: ShadowProgrammer
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-21T01:23:40.233Z
Answers.Text: Your engine will receive position command from an interface or user. See examples. If your engine receives `position startpos` command for example, that means your engine is commanded to setup the start position, and since the side to move of startpos is white, your engine is assigned the color white. Later when your engine receives the command `go movetime 1000`, your engine will analyze the startpos for 1 second or 1000 milliseconds.
Answers.UserDisplayName: ferdy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-18T02:11:22.537Z
Answers.LastActivityDate: 2022-11-19T00:16:43.277Z
Answers.LastEditDate: 2022-11-19T00:16:43.277Z
Answers.UserDisplayName: ferdy
Body: <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>
  
Tags: <programming><uci><python>
Title: UCI Play Colors
ThreadText: # UCI Play Colors
  
  (Asked by: username_0 on 2022-11-17)
  
  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.
  
  **Tags:** programming, uci, python
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-11-18. Score: 5 | Accepted answer
  
  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
  
  > **Comments:**
  > **username_0**: Super helpful! But how do I know which color my engine has been assigned to?  
  > **username_1**: Your engine will receive position command from an interface or user. See examples. If your engine receives `position startpos` command for example, that means your engine is commanded to setup the start position, and since the side to move of startpos is white, your engine is assigned the color white. Later when your engine receives the command `go movetime 1000`, your engine will analyze the startpos for 1 second or 1000 milliseconds.  
  
  ---
  
  