Hi all,
I am considering two options when faced with the situation when a side has a single legal move that it can do. (Preamble: I only check if there is a single legal move when the king is in check, since my move generator generates semi-legal moves).
Option1:
Instead of carrying on with normal Alpha-Beta search at that point, I switch immediately to QS to get a value for the position and return that. My QS however does not keep going on checks, only captures.
Option2:
Perform an extension. That is keep with normal Alpha Beta but search deeper, probably by 1 or 2 plies. That is in case there is a mate or a tactical win nearby which might make the move that caused this side to have only 1 legal move, quite useful.
What do other people do in this case? I am currently implementing option 1 and see what results I get with that, but I will try option 2, and compare.
Regards,
Vlad.
Single legal move - what to do?
Moderators: hgm, Rebel, chrisw
-
- Posts: 161
- Joined: Thu Jan 08, 2009 9:06 pm
- Location: San Francisco, USA
-
- Posts: 27790
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Single legal move - what to do?
Are you talking about the root or just any tree node? Outside the root (1) would be totally fatal. I once had an engine that did this through a bug.
-
- Posts: 128
- Joined: Sat Sep 23, 2006 7:10 pm
- Location: Prague
Re: Single legal move - what to do?
I can not see any reason for 1. Why jump into QSearch? What I do is basicaly extension by 1 ply.
-
- Posts: 161
- Joined: Thu Jan 08, 2009 9:06 pm
- Location: San Francisco, USA
Re: Single legal move - what to do?
Actually you do have a very good question. Since the check for "is there only one legal move" is kind-of expensive for me, I thought just to do it at root. Reading you post makes me think that maybe option 1 is better used at root, whereas option 2 could be used at deeper plies.
I would assume the decision on what to do is not influenced by what type of node (not talking about root here, just PV vs non-PV) I am on right ?
And yes, I would imagine, that option 1 would miss a lot of tactical issues if used in non-root nodes.
Regards,
Vlad.
I would assume the decision on what to do is not influenced by what type of node (not talking about root here, just PV vs non-PV) I am on right ?
And yes, I would imagine, that option 1 would miss a lot of tactical issues if used in non-root nodes.
Regards,
Vlad.
-
- Posts: 778
- Joined: Sat Jul 01, 2006 7:11 am
Re: Single legal move - what to do?
If there is a single legal move at the root, you could just make the move and start pondering.
-
- Posts: 34
- Joined: Mon Nov 17, 2008 6:58 am
Re: Single legal move - what to do?
Do you mean another 1 ply extension? Since incheck extends 1 ply, single response extends another ply.tvrzsky wrote:I can not see any reason for 1. Why jump into QSearch? What I do is basicaly extension by 1 ply.
-
- Posts: 128
- Joined: Sat Sep 23, 2006 7:10 pm
- Location: Prague
Re: Single legal move - what to do?
Yes, exactly. Single response in check = 2 plies extension.edwardyu wrote:Do you mean another 1 ply extension? Since incheck extends 1 ply, single response extends another ply.tvrzsky wrote:I can not see any reason for 1. Why jump into QSearch? What I do is basicaly extension by 1 ply.
-
- Posts: 64
- Joined: Thu Feb 19, 2009 5:34 pm
- Location: Mexico, Mexico
Re: Single legal move - what to do?
Option 2 is a lot better, as one or two possible movs will not make the search slower. And as said J. Wesley, in root you can start pondering inmediatly. This little trick should be on every chess programmer notebook.
-
- Posts: 536
- Joined: Thu Mar 09, 2006 3:01 pm
Re: Single legal move - what to do?
I added a modified version of this to Tinker a few months ago
(with current testing limits, I cannot really say if it is much better or not, but it does seem to help tactically).
When in check Tinker will also extend if there is only one move,
but only if the current ply is <= (iteration+1)/2.
Without this limit to the "top" of the tree, extending by 2 plys will often result in run away searches.
(with current testing limits, I cannot really say if it is much better or not, but it does seem to help tactically).
When in check Tinker will also extend if there is only one move,
but only if the current ply is <= (iteration+1)/2.
Without this limit to the "top" of the tree, extending by 2 plys will often result in run away searches.
-
- Posts: 128
- Joined: Sat Sep 23, 2006 7:10 pm
- Location: Prague
Re: Single legal move - what to do?
This is why I said "basicaly by 2 plies". Because if it is closer than 4 plies to the horizon then the extension is only 1 ply. And my ordinary check extension is fractional - only 7/8 of ply.brianr wrote:I added a modified version of this to Tinker a few months ago
(with current testing limits, I cannot really say if it is much better or not, but it does seem to help tactically).
When in check Tinker will also extend if there is only one move,
but only if the current ply is <= (iteration+1)/2.
Without this limit to the "top" of the tree, extending by 2 plys will often result in run away searches.