Recently I have implemented a function to reverse the color to play in a given position (and to symmetrize the position also i.e. if white have a queen on b2 in a position, black will have a queen on b7 in the symmetrized position), which can be used in test suites as they are known to be very useful to detect bugs.
This function is itself without bugs .
But I found that the search (number of visited nodes in Alpha_Beta, and score for an iteration) is not symmetric if the color to play and the position are reversed. When I use a simple material eval then only the number of visited nodes are just slightly differents. My full eval seems without bugs as far as i know, though it is very complex and may still have some (without bugs=symmetrical for both sides of course).
I have no null move and no transposition tables.
Trying to understand that I played with LMR and found that avoiding to reduce tactical moves reduced the difference of search between a position and the symmetrized position (ok it is good to do that but why could it cause such large effects).
As far as I understand doing the modification above on LMR tends to reduce the difference of search between a position and a symmetrized one.
Before to come to the conclusion, please look at an example on this
initial position :
1k1b3r/ppp3p1/3p1p2/3Pr2q/P2N3p/5Q1P/1PP2PP1/1K1R3R w - - 40
[diag]1k1b3r/ppp3p1/3p1p2/3Pr2q/P2N3p/5Q1P/1PP2PP1/1K1R3R w - - 40[/diag]
it is a well known position given by kostyev and the solution is
Nc6+
Here is the result of Milady search when allowing captures in LMR
(allowing to reduce captures) :
"depth 1 score -23 temps 1 nbnod 47 B_F :46 : f3h5 : Alpha futur -20000 , Beta futur 20000"
"depth 2 score -23 temps 3 nbnod 314 B_F :16,3401346383682 : f3h5 h8h5 : Alpha futur -20000 , Beta futur 20000"
"depth 3 score -16 temps 12 nbnod 1944 B_F :11,7687192189956 : f3h5 h8h5 c2c4 : Alpha futur -20000 , Beta futur 20000"
"depth 4 score 15 temps 27 nbnod 4566 B_F :7,15579963791388 : f3h5 e5h5 d4e6 g7g6 : Alpha futur -20000 , Beta futur 20000"
"depth 5 score -19 temps 91 nbnod 16320 B_F :6,51684118319441 : f3h5 h8h5 c2c4 e5e8 f2f4 : Alpha futur -20000 , Beta futur 20000"
"depth 6 score 16 temps 229 nbnod 39932 B_F :5,35618368662256 : f3h5 e5h5 d4e6 h5f5 f2f4 d8e7 : Alpha futur -20000 , Beta futur 20000"
"depth 7 score 5 temps 531 nbnod 103746 B_F :4,85754202804267 : f3h5 e5h5 d4e6 h5f5 f2f4 d8e7 b1a2 : Alpha futur -20000 , Beta futur 20000"
"depth 8 score 28 temps 1157 nbnod 213429 B_F :4,26596624848348 : f3h5 e5h5 d4e6 h5f5 f2f4 g7g6 h1e1 h8e8 : Alpha futur -20000 , Beta futur 20000"
"depth 9 score 198 temps 4132 nbnod 809431 B_F :4,38222014318091 : d4c6 b8a8 c6e5 f6e5 f3e4 a8b8 d1d3 h5f7 f2f3 : Alpha futur -20000 , Beta futur 20000"
"Test_Stabilité 28: f3h5 198: d4c6"
"Stab = False"
"depth 10 score 194 temps 14752 nbnod 2407956 B_F :4,17226556277527 : d4c6 b8a8 c6e5 f6e5 f3e4 d8g5 f2f3 h8b8 e4f5 c7c5 : Alpha futur -20000 , Beta futur 20000"
Below is the result if I don't allow captures to be reduced:
"depth 1 score -23 temps 1 nbnod 47 B_F :46 : f3h5 : Alpha futur -20000 , Beta futur 20000"
"depth 2 score -23 temps 3 nbnod 314 B_F :16,3401346383682 : f3h5 h8h5 : Alpha futur -20000 , Beta futur 20000"
"depth 3 score -16 temps 12 nbnod 1940 B_F :11,7590845694012 : f3h5 h8h5 c2c4 : Alpha futur -20000 , Beta futur 20000"
"depth 4 score 15 temps 29 nbnod 4650 B_F :7,21509946842602 : f3h5 e5h5 d4e6 g7g6 : Alpha futur -20000 , Beta futur 20000"
"depth 5 score -19 temps 98 nbnod 17130 B_F :6,59542698873255 : f3h5 h8h5 c2c4 e5e8 f2f4 : Alpha futur -20000 , Beta futur 20000"
"depth 6 score 16 temps 243 nbnod 42339 B_F :5,41492696105803 : f3h5 e5h5 d4e6 h5f5 f2f4 d8e7 : Alpha futur -20000 , Beta futur 20000"
"depth 7 score 5 temps 553 nbnod 110533 B_F :4,90382729325774 : f3h5 e5h5 d4e6 h5f5 f2f4 d8e7 b1a2 : Alpha futur -20000 , Beta futur 20000"
"depth 8 score 28 temps 1531 nbnod 267340 B_F :4,46088143911947 : f3h5 e5h5 d4e6 h5f5 f2f4 g7g6 h1e1 h8e8 : Alpha futur -20000 , Beta futur 20000"
"depth 9 score 195 temps 5685 nbnod 1110013 B_F :4,55414196182894 : d4c6 b8a8 c6e5 f6e5 f3h5 h8h5 h1e1 h5f5 f2f3 : Alpha futur -20000 , Beta futur 20000"
"Test_Stabilité 28: f3h5 195: d4c6"
"Stab = False"
"depth 10 score 206 temps 13291 nbnod 2342889 B_F :4,06529382043233 : d4c6 b8a8 c6e5 f6e5 h1e1 h5g5 e1e3 h8e8 e3b3 c7c5 : Alpha futur -20000 , Beta futur 20000"
Now the reverse position :
1k1r3r/1pp2pp1/5q1p/p2n3P/3pR2Q/3P1P2/PPP3P1/1K1B3R b - - 40
[diag]1k1r3r/1pp2pp1/5q1p/p2n3P/3pR2Q/3P1P2/PPP3P1/1K1B3R b - - 40[/diag]
For this reverse position; the analysis of Milady when LMR allow
captures
"depth 1 score 0 temps 1 nbnod 46 B_F :45 : f6h4 : Alpha futur -20000 , Beta futur 20000"
"depth 2 score -23 temps 3 nbnod 221 B_F :13,228756555323 : f6h4 h1h4 : Alpha futur -20000 , Beta futur 20000"
"depth 3 score -16 temps 9 nbnod 1326 B_F :10,3384181241454 : f6h4 h1h4 c7c5 : Alpha futur -20000 , Beta futur 20000"
"depth 4 score 15 temps 21 nbnod 3386 B_F :6,73700399819095 : f6h4 e4h4 d5e3 g2g3 : Alpha futur -20000 , Beta futur 20000"
"depth 5 score 9 temps 70 nbnod 13004 B_F :6,26061438188652 : f6h4 e4h4 d5e3 h4f4 e3d1 : Alpha futur -20000 , Beta futur 20000"
"depth 6 score 15 temps 152 nbnod 26118 B_F :4,85611761235252 : f6h4 e4h4 d5e3 g2g3 e3d1 h1d1 : Alpha futur -20000 , Beta futur 20000"
"depth 7 score 5 temps 442 nbnod 87191 B_F :4,82717174234912 : f6h4 e4h4 d5e3 h4f4 f7f5 d1e2 b8a7 : Alpha futur -20000 , Beta futur 20000"
"depth 8 score 16 temps 1035 nbnod 193754 B_F :4,25060554862605 : f6h4 e4h4 d5e3 h4f4 f7f6 g2g3 e3d1 h1d1 : Alpha futur -20000 , Beta futur 20000"
"depth 9 score 9 temps 2892 nbnod 592517 B_F :4,19084550114119 : f6h4 e4h4 d5e3 h4e4 e3g2 e4g4 g2e3 g4g7 f7f6 : Alpha futur -20000 , Beta futur 20000"
"depth 10 score 25 temps 7333 nbnod 1368591 B_F :3,88141708692493 : f6h4 e4h4 d5e3 h4e4 h8e8 g2g3 e3f5 e4e8 d8e8 g3g4 : Alpha futur -20000 , Beta futur 20000"
The good move is not found even at depth 10 !
But when the captures are not reduced by LMR :
"depth 1 score 0 temps 1 nbnod 46 B_F :45 : f6h4 : Alpha futur -20000 , Beta futur 20000"
"depth 2 score -23 temps 3 nbnod 221 B_F :13,228756555323 : f6h4 h1h4 : Alpha futur -20000 , Beta futur 20000"
"depth 3 score -16 temps 9 nbnod 1357 B_F :10,4342068925523 : f6h4 h1h4 c7c5 : Alpha futur -20000 , Beta futur 20000"
"depth 4 score 15 temps 21 nbnod 3495 B_F :6,79989059373661 : f6h4 e4h4 d5e3 g2g3 : Alpha futur -20000 , Beta futur 20000"
"depth 5 score 9 temps 74 nbnod 13880 B_F :6,35742580171929 : f6h4 e4h4 d5e3 h4f4 e3d1 : Alpha futur -20000 , Beta futur 20000"
"depth 6 score 15 temps 156 nbnod 28719 B_F :4,95717334500454 : f6h4 e4h4 d5e3 g2g3 e3d1 h1d1 : Alpha futur -20000 , Beta futur 20000"
"depth 7 score 12 temps 517 nbnod 103560 B_F :4,96941943948923 : f6h4 e4h4 d5e3 h4f4 f7f5 d1e2 c7c5 : Alpha futur -20000 , Beta futur 20000"
"depth 8 score 16 temps 1301 nbnod 242808 B_F :4,39514918307835 : f6h4 e4h4 d5e3 h4f4 f7f6 g2g3 e3d1 h1d1 : Alpha futur -20000 , Beta futur 20000"
"depth 9 score 187 temps 5303 nbnod 1071272 B_F :4,54554498535173 : d5c3 b1c1 c3e4 f3e4 f6g5 h4g5 h6g5 d1g4 h8h6 : Alpha futur -20000 , Beta futur 20000"
"Test_Stabilité 16: f6h4 187: d5c3"
"Stab = False"
"depth 10 score 191 temps 12083 nbnod 2164080 B_F :4,01656118063693 : d5c3 b1c1 c3e4 f3e4 f6g5 h4g5 h6g5 d1g4 h8e8 h5h6 : Alpha futur -20000 , Beta futur 20000"
this search result is much more consistent with the one of the symmetrized position.
Now i come with the conclusions, and i would be very glad to have
your advice . In fact I'm completely lost and have no good explanation for this behaviour, so if you observed something near
in the past, please give me your advice. Also, is it normal that
a search may be unsymmetric?
Sorry for that long description,
Yves