-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Remove check for normal moves in LMR and replace see by see_sign #560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I just updated to the latest master and made the change, and the assert still fires. Also, regarding see_sign: Why must it be better? The condition in see_sign cannot possibly be true in this context except in the CASTLING case. The rest of the time, it will be (slightly) slower than see. EDIT: In fact, the precise effect of this pull request is to revert this commit: 187a9fe |
|
I am impressed, wow. I have two remarks:
I let it run until depth 26 from start position without any problems. Am I doing something wrong?
|
|
Actually, I was looking at the first patch (removal of the type == NORMAL condition) without the see_sign change. With see_sign, the assert won't fire for the reason given in the description of the linked commit. |
|
But for me neither fires. |
|
That's odd. To answer your earlier question, I use Visual C++ 2015 and the assert fires in debug mode. One can logically see that it should fire without see_sign though. Consider white's kingside castling in standard chess (not Chess960), the move would be encoded as e1->h1 (king captures rook), so the reverse move passed to see would be encoded as h1->e1, both of which will be empty following a castling. So when see calls color_of(piece_on(from)) this is color_of(piece_on(H1)) == color_of(NO_PIECE). The assert should fire. |
|
|
|
Knowing the background now, I am quite neutral about the patch. Test has showed that there is nothing to be scared of. If mantainers do not want to commit, could you @mcostalba integrate the comment to line 1008? Otherwise we will make the same discussion in July 2017... |
|
Ah, and now I see: the assert fires for me too for the version with see. I must have done something wrong last time. |
|
@Stefano80 I agree we can add one comment to current code to better explain why it is done in that way (check only normal moves and use see instead of see_sign). Eventually you can use this pull request for this: add the comment and revert the code to the original one. |
|
Ok, if none objects. I will do as soon as Lucas tests are finished. Maybe in the meanwhile mantainers can express their opinion. |
|
What you can do is this: No need to call the function.... As any king movement including castling will not be <0. Using see_sign() will only trigger if it's a king movement. But adding the code above... using see_sign() will be redundant as it will always call see(). |
|
@VoyagerOne That won't work, as to_sq of a castling move is not the king destination but the rook origin, so it will be empty in standard chess (and only nonempty in certain Chess960 positions). |
|
@DU-jdto AFTER making the castling move. The piece on to_sq should definitely be the king. Looking under the hood: You would be correct if it was BEFORE we make the move. |
|
@VoyagerOne Where make is implemented in type.cpp as: Indeed, this fact is why the assert fires at all, because to_sq(move) refers to an empty square in the CASTLING case. Just to be absolutely sure, I've tried your proposed change, and the assert still fires. You should find the same if you try it. |
|
@DU-jdto |
|
I agree with Marco that a clarifying comment would be the best. Suggested actions:
|
|
Ok, I do as suggested. |
If kings are adjacent, 960-style castling into discovered check is illegal. STC LLR: 2.99 (-2.94,2.94) [-10.00,5.00] Total: 7651 W: 2570 L: 2567 D: 2514 http://35.161.250.236:6543/tests/view/5d6d7ccf6e23db3768ec07ce
…#560 STC LLR: 3.00 (-2.94,2.94) [-10.00,5.00] Total: 4026 W: 1317 L: 1291 D: 1418 http://35.161.250.236:6543/tests/view/5d6e60b76e23db3768ec07dd
STC LLR: 2.96 (-2.94,2.94) [-10.00,5.00] Total: 19229 W: 6266 L: 6337 D: 6626 http://35.161.250.236:6543/tests/view/5d6e41f86e23db3768ec07da
Remove non necessary condition in LMR step and replace see by see_sign.
Bench is unchanged also as higher depth.
original: bench/15: 23329380 bench/20: 170471032 start/25: 112078091
branch (see_sign): bench/15: 23329380 bench/20: 170471032 start/25: 112078091
branch (see): bench/15: 23329380 bench/20: 170471032 start/25: 112078091
Benches were run with debug=yes: no assert firing. Please confirm in view of comment by @DU-jdto.
see version passed a sanity SPRT 10+0.1 [-3, 1]
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 54439 W: 9983 L: 9920 D: 34536
see_sign version did not actually pass SPRT 10+0.1 [-3, 1] but must be better than see version
LLR: -2.96 (-2.94,2.94) [-3.00,1.00]
Total: 81751 W: 14892 L: 15191 D: 51668