Only recaptures in qsearch?
Posted: Sat Nov 21, 2009 11:40 pm
A few months ago, I was working on significantly improving the speed of my engine, and it was suggested by a couple of people that I should have the qsearch only check recaptures after the first capture. In other words, in the first ply of the qsearch, all moves are checked, but in each ply after that, only recaptures on the same target square are checked.
I implemented this and, no surprise, I got a big boost in speed.
Since then I have also added promotions to qsearch, and those can be checked at any ply, regardless of the target square.
But I recently had a thought that this "recapture only" method could be very dangerous. Consider this position, if it is reached at the beginning of qsearch:
[D] 2k5/2r3r1/1P6/8/8/8/1K4Q1/8 w
The recapture method will clearly see that Qxg7 is bad, because Black can recapture with Rxg7, which is on the same square. But it will see that bxc7 is GOOD, because (if only recaptures are checked), then Black will play Rxc7 and White supposedly wins material. But it completely misses that Black can play Rxg2, winning the queen.
So, I have changed my implementation such that the first TWO plies of the qsearch can be on any square, effectively giving the opponent the opportunity to choose the recapture square. I'm pretty sure this will solve the entire problem. But, of course, the qsearch is now noticeably slower.
Is this an effective way of solving the problem? Or was there really no problem at all? Or is the idea too dangerous even with this change and I should go back to checking all captures at all plies in qsearch?
Your thoughts are appreciated,
jm
I implemented this and, no surprise, I got a big boost in speed.
Since then I have also added promotions to qsearch, and those can be checked at any ply, regardless of the target square.
But I recently had a thought that this "recapture only" method could be very dangerous. Consider this position, if it is reached at the beginning of qsearch:
[D] 2k5/2r3r1/1P6/8/8/8/1K4Q1/8 w
The recapture method will clearly see that Qxg7 is bad, because Black can recapture with Rxg7, which is on the same square. But it will see that bxc7 is GOOD, because (if only recaptures are checked), then Black will play Rxc7 and White supposedly wins material. But it completely misses that Black can play Rxg2, winning the queen.
So, I have changed my implementation such that the first TWO plies of the qsearch can be on any square, effectively giving the opponent the opportunity to choose the recapture square. I'm pretty sure this will solve the entire problem. But, of course, the qsearch is now noticeably slower.
Is this an effective way of solving the problem? Or was there really no problem at all? Or is the idea too dangerous even with this change and I should go back to checking all captures at all plies in qsearch?
Your thoughts are appreciated,
jm