Discussion of chess software programming and technical issues.
Moderators: hgm, Harvey Williamson, bob
Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
-
fierz
- Posts: 62
- Joined: Mon Mar 07, 2016 3:41 pm
- Location: Zürich, Switzerland
-
Contact:
Post
by fierz » Tue Mar 22, 2016 6:09 pm
Dear all,
I recently integrated LMR (or some variant of it) into my engine, with good results. My code looks like this
Code: Select all
LMR = 0;
if (i > LMR_N && // only try late moves i> 4
iscapture[realdepth - 1] == 0 && // don't try on captures
depth > LMR_MINDEPTH && // only if some depth is remaining
ischeck[realdepth - 1] == 0 && // not if we are moving out of a check
ispawnpush[realdepth -1] == 0 && // not for passed pawn pushes
ispv == 0 // not for the pv
// TODO: promotions have to be exempt! but this is such a rare occasion that it shouldn't matter
) {
// LMR candidate - check if we are in check
if (p->sidetomove == WHITE && !(isattacked(p, p->wking, BLACK)))
LMR = LMR_REDUCE;
if (p->sidetomove == BLACK && !(isattacked(p, p->bking, WHITE)))
LMR = LMR_REDUCE;
Now I wonder: since reductions are sort of inverted extensions, and LMR reduces all kinds of moves but not checks, and not captures, and not pawn pushes, do I still need these check/recapture/pawnpush extensions or not? Do you still have them?
cheers
Martin
-
bob
- Posts: 20342
- Joined: Mon Feb 27, 2006 6:30 pm
- Location: Birmingham, AL
Post
by bob » Tue Mar 22, 2016 8:44 pm
fierz wrote:Dear all,
I recently integrated LMR (or some variant of it) into my engine, with good results. My code looks like this
Code: Select all
LMR = 0;
if (i > LMR_N && // only try late moves i> 4
iscapture[realdepth - 1] == 0 && // don't try on captures
depth > LMR_MINDEPTH && // only if some depth is remaining
ischeck[realdepth - 1] == 0 && // not if we are moving out of a check
ispawnpush[realdepth -1] == 0 && // not for passed pawn pushes
ispv == 0 // not for the pv
// TODO: promotions have to be exempt! but this is such a rare occasion that it shouldn't matter
) {
// LMR candidate - check if we are in check
if (p->sidetomove == WHITE && !(isattacked(p, p->wking, BLACK)))
LMR = LMR_REDUCE;
if (p->sidetomove == BLACK && !(isattacked(p, p->bking, WHITE)))
LMR = LMR_REDUCE;
Now I wonder: since reductions are sort of inverted extensions, and LMR reduces all kinds of moves but not checks, and not captures, and not pawn pushes, do I still need these check/recapture/pawnpush extensions or not? Do you still have them?
cheers
Martin
I removed everything but check extensions a couple of years back. Was an Elo gain to do so. Removing check extension hurt, however... Although I found another Elo gain by not extending checks that SEE says loses material...
-
hgm
- Posts: 22274
- Joined: Fri Mar 10, 2006 9:06 am
- Location: Amsterdam
- Full name: H G Muller
-
Contact:
Post
by hgm » Tue Mar 22, 2016 9:09 pm
Would it help to extend checks and do LMR on them? I.e. only extend if they beat alpha?
-
jdart
- Posts: 3502
- Joined: Fri Mar 10, 2006 4:23 am
- Location: http://www.arasanchess.org
Post
by jdart » Tue Mar 22, 2016 9:30 pm
hgm wrote:Would it help to extend checks and do LMR on them? I.e. only extend if they beat alpha?
I assume you mean, reduce losing checks? That sounds like a reasonable idea but most engines don't do that. (Mine doesn't either although it is a little hard to see why in the code .. I only reduce moves that are in the "history phase" of move generation, and check evasions have no such phase). Last I tried it was not an improvement.
--Jon
-
hgm
- Posts: 22274
- Joined: Fri Mar 10, 2006 9:06 am
- Location: Amsterdam
- Full name: H G Muller
-
Contact:
Post
by hgm » Tue Mar 22, 2016 9:46 pm
Well, you would only know they are losing after you searched them. So what I mean is reducing all checks (possibly by 0 ply), and then re-search them with an extension if they score above alpha. Just as with any LMR'ed move. Another way to describe this as applying normal LMR after you have given the extension.
-
bob
- Posts: 20342
- Joined: Mon Feb 27, 2006 6:30 pm
- Location: Birmingham, AL
Post
by bob » Tue Mar 22, 2016 11:04 pm
hgm wrote:Would it help to extend checks and do LMR on them? I.e. only extend if they beat alpha?
I tried several combinations recently.
(1) no check extensions. -10 Elo in Crafty
(2) extend checks with SEE >= 0, 0 (normal)
(3) LMR unsafe checks (SEE < 0) -10 Elo
That's not to say there is not some middle ground. IE LMR still applied to SEE < 0 checks, just a smaller reduction. That's not yet been tried.
-
bob
- Posts: 20342
- Joined: Mon Feb 27, 2006 6:30 pm
- Location: Birmingham, AL
Post
by bob » Tue Mar 22, 2016 11:06 pm
hgm wrote:Well, you would only know they are losing after you searched them. So what I mean is reducing all checks (possibly by 0 ply), and then re-search them with an extension if they score above alpha. Just as with any LMR'ed move. Another way to describe this as applying normal LMR after you have given the extension.
Sounds worth testing, but not something I have done...
-
fierz
- Posts: 62
- Joined: Mon Mar 07, 2016 3:41 pm
- Location: Zürich, Switzerland
-
Contact:
Post
by fierz » Thu Mar 24, 2016 11:51 am
bob wrote:
I removed everything but check extensions a couple of years back. Was an Elo gain to do so. Removing check extension hurt, however... Although I found another Elo gain by not extending checks that SEE says loses material...
Thanks for sharing. It seems to have done my engine a world of good
cheers
Martin
-
Robert Pope
- Posts: 392
- Joined: Sat Mar 25, 2006 7:27 pm
Post
by Robert Pope » Thu Mar 24, 2016 4:06 pm
How big is your LMR_REDUCE? I am only using one for now. I've tried 4-5 variations of LMR and they always perform significantly worse (60-80 ELO) than my baseline without LMR.
-
fierz
- Posts: 62
- Joined: Mon Mar 07, 2016 3:41 pm
- Location: Zürich, Switzerland
-
Contact:
Post
by fierz » Thu Mar 24, 2016 4:17 pm
Dear Robert,
my LMR_REDUCE is 1 ply and it works very very well!
cheers
Martin