Page 1 of 1

RootMove sorting in Stockfish

Posted: Fri May 11, 2018 12:27 pm
by Look
Hi,

Since I am not a C++ coder, can you describe what is the sorting method of RootMove in Stockfish 9 ? In other words IMHO how the moves are sorted and fed into AlphaBeta ?

Re: RootMove sorting in Stockfish

Posted: Sat May 12, 2018 7:08 am
by Eelco de Groot
I'm not really the one to ask but, as far as I know, no special Root move sorting in Stockfish. This is by design because, apparently, it works better not changing the order in which moves are searched. Only the best move found so far is at the top, immediately below that earlier best moves found by search (I think, but admittedly I have not checked). The rest of the order, moves which were never best move, is the order in which the moves are placed by movepick.cpp on characteristics of the moves alone, so not sorted by eval or search in any way, (but SEE plays a role). This is usually referenced as 'move sorting' in theory, so if that is what you were asking I must refer to movepick.cpp

Re: RootMove sorting in Stockfish

Posted: Sun May 13, 2018 12:57 pm
by Look
I may ask about a mission here:

Modify Stockfish 9 such that given a "command FEN", it would output the FEN and the move sort of the root moves. That is, how moves are sorted before being given to Alpha-Beta.

Re: RootMove sorting in Stockfish

Posted: Sun May 13, 2018 1:01 pm
by syzygy
Look wrote: Sun May 13, 2018 12:57 pm I may ask about a mission here:

Modify Stockfish 9 such that given a "command FEN", it would output the FEN and the move sort of the root moves. That is, how moves are sorted before being given to Alpha-Beta.
Your signature suggests you at least know some basic C. You should be able to accomplish your mission...

You might learn then that, as has already been explained by Eelco, the root moves are sorted as the search iterates through its iterations. So there is no "the move sort of the root moves".

Re: RootMove sorting in Stockfish

Posted: Sun May 13, 2018 1:42 pm
by syzygy
And if you know C but somehow cannot understand C++, just have a look at how Cfish sorts the root moves (identically to Stockfish):
https://github.com/syzygy1/Cfish