user34001: I am working on a chess player-rating system based on engine evaluations. As part of this I would like to extract evaluation data from Stockfish for the top 10 moves in a given set of positions.
Ideally I would like to be able to loop this from my program, so something like:
while i < 1000:
#'evaluate' returns a list of top moves with their centipawn evaluations.
choices = evaluate(positions[i]); 
...do stuff...
i++;
end while

In the above 'positions' would be a vector of chess positions in FEN format. I have looked around and there are some solutions for this using the chess library in Python, but I would really like to do this from within cpp. Is there any relatively trouble-free way to do this?

user825: The Python solutions are nothing but wrapper for sending UCI commands to the Stockfish engine. I'm not aware there is a C++ equivalent but you can code it yourself.
I don't have a copy-and-paste ready code for you. To do what you want you will need:

Start Stockfish as a child process (or as a thread). https://www.reddit.com/r/learnprogramming/comments/q8sra3/how_do_i_make_a_uci_connect_to_my_c_gui/
Communicate with your engine appropriately (lot's of materials on Stackoverflow)
Learn the UCI commands
Start a MultiPV analysis of 10
Parse the results. Use a bitboard implementation to generate a FEN for each move.


34001: <p>I am working on a chess player-rating system based on engine evaluations. As part of this I would like to extract evaluation data from Stockfish for the top 10 moves in a given set of positions.</p>
<p>Ideally I would like to be able to loop this from my program, so something like:</p>
<pre><code>while i &lt; 1000:
#'evaluate' returns a list of top moves with their centipawn evaluations.
choices = evaluate(positions[i]); 
...do stuff...
i++;
end while
</code></pre>
<p>In the above 'positions' would be a vector of chess positions in FEN format. I have looked around and there are some solutions for this using the chess library in Python, but I would really like to do this from within cpp. Is there any relatively trouble-free way to do this?</p>
 825: <p>The Python solutions are nothing but wrapper for sending UCI commands to the Stockfish engine. I'm not aware there is a C++ equivalent but you can code it yourself.</p>
<p>I don't have a copy-and-paste ready code for you. To do what you want you will need:</p>
<ul>
<li>Start Stockfish as a child process (or as a thread). <a href="https://www.reddit.com/r/learnprogramming/comments/q8sra3/how_do_i_make_a_uci_connect_to_my_c_gui/" rel="nofollow noreferrer">https://www.reddit.com/r/learnprogramming/comments/q8sra3/how_do_i_make_a_uci_connect_to_my_c_gui/</a></li>
<li>Communicate with your engine appropriately (lot's of materials on Stackoverflow)</li>
<li>Learn the <a href="https://www.wbec-ridderkerk.nl/html/UCIProtocol.html" rel="nofollow noreferrer">UCI commands</a></li>
<li>Start a MultiPV analysis of 10</li>
<li>Parse the results. Use a bitboard implementation to generate a FEN for each move.</li>
</ul>
