RootMove sorting in Stockfish

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
Look
Posts: 112
Joined: Thu Jun 05, 2014 12:14 pm
Location: Iran
Full name: Mehdi Amini
Contact:

RootMove sorting in Stockfish

Post by Look » Fri May 11, 2018 10:27 am

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 ?
Mehdi Amini
www.my-c-codes.com/

Farewell.

User avatar
Eelco de Groot
Posts: 3909
Joined: Sun Mar 12, 2006 1:40 am
Location: Groningen

Re: RootMove sorting in Stockfish

Post by Eelco de Groot » Sat May 12, 2018 5:08 am

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
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan

Look
Posts: 112
Joined: Thu Jun 05, 2014 12:14 pm
Location: Iran
Full name: Mehdi Amini
Contact:

Re: RootMove sorting in Stockfish

Post by Look » Sun May 13, 2018 10:57 am

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.
Mehdi Amini
www.my-c-codes.com/

Farewell.

syzygy
Posts: 4310
Joined: Tue Feb 28, 2012 10:56 pm

Re: RootMove sorting in Stockfish

Post by syzygy » Sun May 13, 2018 11:01 am

Look wrote:
Sun May 13, 2018 10:57 am
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".

syzygy
Posts: 4310
Joined: Tue Feb 28, 2012 10:56 pm

Re: RootMove sorting in Stockfish

Post by syzygy » Sun May 13, 2018 11:42 am

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

Post Reply