info depth 1 seldepth 1 score cp 40 time 9 nodes 41 pv e2e4
...
info depth 6 seldepth 6 score cp 94 time 2532 nodes 165366 pv d2d4 a7a6 g1f3 d1d3
info depth 6 seldepth 6 score cp -19 time 5379 nodes 370469 pv e2e3 d7d5 d1h5 d8d6 f1b5 b8c6
info depth 7 seldepth 7 score cp 56 time 8557 nodes 593431 pv a2a3 a7a6 e2e4 a6a5 d2d4 e7e5 b1c3
info depth 7 seldepth 7 score cp 67 time 11126 nodes 767157 pv a2a3 b7b6 e2e4 c8a6 d1h5 a6f1 e1f1
That is not odd, you have to make sure that all capture sequences are resolved before you analyze the position statically.
When you disable the quiescence search, or stop the quiescence somewhere in the middle (which has the same effect), you will get an enormous horizon effect which makes your engine play tactical mistakes.
I forget one which also worked for Skipper: return best move found so far at root level when time is up even if search is not finished. But drawback was that after that I was not able to implement aspiration search correctly.
info depth 1 seldepth 1 score cp 40 time 9 nodes 41 pv e2e4
...
info depth 6 seldepth 6 score cp 94 time 2532 nodes 165366 pv d2d4 a7a6 g1f3 d1d3
info depth 6 seldepth 6 score cp -19 time 5379 nodes 370469 pv e2e3 d7d5 d1h5 d8d6 f1b5 b8c6
info depth 7 seldepth 7 score cp 56 time 8557 nodes 593431 pv a2a3 a7a6 e2e4 a6a5 d2d4 e7e5 b1c3
info depth 7 seldepth 7 score cp 67 time 11126 nodes 767157 pv a2a3 b7b6 e2e4 c8a6 d1h5 a6f1 e1f1
That is not odd, you have to make sure that all capture sequences are resolved before you analyze the position statically.
When you disable the quiescence search, or stop the quiescence somewhere in the middle (which has the same effect), you will get an enormous horizon effect which makes your engine play tactical mistakes.
So a premature end of the q-search by limitting it to e.g. 2 can cause this. Ok, but I also see this when not checking all capture moves, e.g. when only checking re-captures.
info depth 1 seldepth 1 score cp 40 time 9 nodes 41 pv e2e4
...
info depth 6 seldepth 6 score cp 94 time 2532 nodes 165366 pv d2d4 a7a6 g1f3 d1d3
info depth 6 seldepth 6 score cp -19 time 5379 nodes 370469 pv e2e3 d7d5 d1h5 d8d6 f1b5 b8c6
info depth 7 seldepth 7 score cp 56 time 8557 nodes 593431 pv a2a3 a7a6 e2e4 a6a5 d2d4 e7e5 b1c3
info depth 7 seldepth 7 score cp 67 time 11126 nodes 767157 pv a2a3 b7b6 e2e4 c8a6 d1h5 a6f1 e1f1
That is not odd, you have to make sure that all capture sequences are resolved before you analyze the position statically.
When you disable the quiescence search, or stop the quiescence somewhere in the middle (which has the same effect), you will get an enormous horizon effect which makes your engine play tactical mistakes.
So a premature end of the q-search by limitting it to e.g. 2 can cause this. Ok, but I also see this when not checking all capture moves, e.g. when only checking re-captures.
Only checking recaptures is not sufficient, you will miss things like pieces that are overloaded or pinned.
Usually you have to check all winning and equal captures, you can omit losing captures because it is very likely that they won't increase your score.
Equal captures don't increase your material score, but they can have influence on your positional score and that might just be enough to get your total score above alpha.
You can determine upfront how big the increase in score has to be to get above alpha.
For instance when your score is 400 cp below alpha it is not very useful to capture a pawn that gains you 100 cp, although it might be a winning capture you can safely skip this.
Likewise you only have to check equal captures when your score is already very close to alpha.
Joost Buijs wrote:Only checking recaptures is not sufficient, you will miss things like pieces that are overloaded or pinned.
Usually you have to check all winning and equal captures, you can omit losing captures because it is very likely that they won't increase your score.
Equal captures don't increase your material score, but they can have influence on your positional score and that might just be enough to get your total score above alpha.
You can determine upfront how big the increase in score has to be to get above alpha.
For instance when your score is 400 cp below alpha it is not very useful to capture a pawn that gains you 100 cp, although it might be a winning capture you can safely skip this.
Likewise you only have to check equal captures when your score is already very close to alpha.
So do I understand it correctly that I either:
- check if, when capturing, the value of my piece >= opponent piece
- check if the value of opponent piece >= alpha - eval_of_current_position()
flok wrote:
So do I understand it correctly that I either:
- check if, when capturing, the value of my piece >= opponent piece
- check if the value of opponent piece >= alpha - eval_of_current_position()
right?
second condition is mostly right (you usually add in a margin as well to cover how much you expect the nonmaterial score might be able to shift)
first condition is not quite broad enough (probably). if the opponent's piece is unprotected or insufficiently protected it still should be tried in qsearch.
flok wrote:
So do I understand it correctly that I either:
- check if, when capturing, the value of my piece >= opponent piece
- check if the value of opponent piece >= alpha - eval_of_current_position()
right?
It all comes down to determining the material gain of the capture move you are going to try, you can do this either by using SEE(), or looking at the piece values directly.
When the piece that will be captured is undefended you can take it's full value, when the piece is defended you can take it's full value minus the value of the piece you are capturing with.
You also have to add a safety margin because you don't know in advance what kind of influence the capture will have on the positional score.
When you have a means to determine the material gain, basically the whole algorithm boils down to this: