Incredible, but found a way to benefit from a root move sorting.
Match: W0173ag3 vs. W0173aa0 @ 10+0.1 / Date: 2023-05-01 00:38:14
[ 0...6] LLR : 2.7952
Total: 6941 W: 2425 L: 2256 D: 2260
Wins: 169 Ratio: 0.5120 Draws: 32.56% ELO: 8
I just rotate uint8 left an set the lowest bit if the root move becomes best.
For sorting I have TT-Move as best (Sorting = TT-Score) and then I
sort the moves with an entry below this one (TT-Score minus position of lowest bit),
if no entry then sort according to normal sorting (history, etc).
Would like to know if anyone else also achieves any gains or this is just
engine specific.
Thanks
Root Move Sorting / Different Approach
Moderator: Ras
-
- Posts: 28353
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Root Move Sorting / Different Approach
I have no idea what you are doing. What is this uint8?
Normally I just move the best move of an iteration to the top of the move list, so that the next iteration would start with it. In the root as well as in other nodes.
Normally I just move the best move of an iteration to the top of the move list, so that the next iteration would start with it. In the root as well as in other nodes.
-
- Posts: 16
- Joined: Mon Sep 26, 2016 8:59 pm
Re: Root Move Sorting / Different Approach
uint8 is an 8-Bit unsigned integer.
Here's the Pseudo-Code:
Search Pseudo-Code at Root-Position (e.g. Nega-Max):
MoveGenerator-Sorting Pseudo-Code at Root-Position:
Verification Run also confirmed the gain
Match: W0173ag3 vs. W0173aa0 @ 105 + 1.05 / Date: 2023-05-02 07:09:12
[ 0...6] LLR : 2.7767
Total: 5136 W: 1682 L: 1537 D: 1917
Wins: 145 Ratio: 0.5140 Draws: 37.32% ELO: 9
Here's the Pseudo-Code:
Search Pseudo-Code at Root-Position (e.g. Nega-Max):
Code: Select all
if Score > Alpha
then
... other stuff ...
Array[From][To]=(Array[From][To] << 1) | 1;
... other stuff ...
else
... other stuff ...
Array[From][To]=(Array[From][To] << 1);
... other stuff ...
MoveGenerator-Sorting Pseudo-Code at Root-Position:
Code: Select all
Loop over all generated moves:
... other stuff ...
if (Array[From][To] > 0) then
SortingArray[Move-Index]=HashSortingBonus - __builtin_ffsll(Array[From][To]);
... other stuff
End of Loop
Verification Run also confirmed the gain
Match: W0173ag3 vs. W0173aa0 @ 105 + 1.05 / Date: 2023-05-02 07:09:12
[ 0...6] LLR : 2.7767
Total: 5136 W: 1682 L: 1537 D: 1917
Wins: 145 Ratio: 0.5140 Draws: 37.32% ELO: 9
-
- Posts: 28353
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Root Move Sorting / Different Approach
That is obvious. The question was what it contains, and for which purpose this is used. It is also not clear to me what SortingArray[] is used for.
I normally just have an array moveStack[] containing the moves and a sort key in the upper byte, and initially sort it by that key. Each move that becomes best is then moved to the start of that list.