Many engines like Maverick and Chesser use ply as an argument for alphabeta search. In both, I couldn't implement LMR, because it takes ply as argument and LMR needs the move to be searched at depth-2. If you try ply+2, it corrupts history heuristics. Everything else fails too. I'm confused now.
Does anyone know how to solve this without removing the need of ply as an argument?
What ply is depth-2?
Moderator: Ras
-
vittyvirus
- Posts: 646
- Joined: Wed Jun 18, 2014 2:30 pm
- Full name: Fahad Syed
-
Sven
- Posts: 4052
- Joined: Thu May 15, 2008 9:57 pm
- Location: Berlin, Germany
- Full name: Sven Schüle
Re: What ply is depth-2?
I'd say: "depth" is usually "remaining depth", and "ply" is often used as the distance of the current node to the root node. In that case, if you decide to search from the current node with a reduced remaining depth then this does not affect the distance to root, so with LMR you can search the move with depth-2 but still pass "ply", not "ply+2" or anything like that.vittyvirus wrote:Many engines like Maverick and Chesser use ply as an argument for alphabeta search. In both, I couldn't implement LMR, because it takes ply as argument and LMR needs the move to be searched at depth-2. If you try ply+2, it corrupts history heuristics. Everything else fails too. I'm confused now.
Does anyone know how to solve this without removing the need of ply as an argument?
-
vittyvirus
- Posts: 646
- Joined: Wed Jun 18, 2014 2:30 pm
- Full name: Fahad Syed
Re: What ply is depth-2?
Well, I tried that before but, it overwrites current position heuristics, and move lists.Sven Schüle wrote:I'd say: "depth" is usually "remaining depth", and "ply" is often used as the distance of the current node to the root node. In that case, if you decide to search from the current node with a reduced remaining depth then this does not affect the distance to root, so with LMR you can search the move with depth-2 but still pass "ply", not "ply+2" or anything like that.vittyvirus wrote:Many engines like Maverick and Chesser use ply as an argument for alphabeta search. In both, I couldn't implement LMR, because it takes ply as argument and LMR needs the move to be searched at depth-2. If you try ply+2, it corrupts history heuristics. Everything else fails too. I'm confused now.
Does anyone know how to solve this without removing the need of ply as an argument?
-
kbhearn
- Posts: 411
- Joined: Thu Dec 30, 2010 4:48 am
Re: What ply is depth-2?
assuming 'ply' is the distance from the root, it should always be ply+1 to index the next entry in your arrays. no reductions or extensions should change this as you're always moving one move further from the root.
-
cdani
- Posts: 2204
- Joined: Sat Jan 18, 2014 10:24 am
- Location: Andorra
Re: What ply is depth-2?
Hi!
A very basic example of LMR in cheeser. I do not claim that it's any good
.
So the idea is to try depth-2 and if it's good enough, don't try the standard depth-1.
Of course is just to show the idea. Any engine instead of trying depth-2 do variable reductions, and with more conditions.
A very basic example of LMR in cheeser. I do not claim that it's any good
Code: Select all
bool dopvs=true;
if (movesfound != 0
&& depth>5
&& !moveBuffer[i].getCapt()
&& !moveBuffer[i].isPromotion()
&& !moveBuffer[i].isCastle())
{
val = -alphabetapvs(ply+1, depth-2, -alpha-1, -alpha);
if (val <= alpha) {
dopvs=false;
}
}
inodes++;
if (--countdown <=0) readClockAndInput();
movesfound++;
if (!ply) displaySearchStats(3, ply, i);
if (dopvs) {
if (pvmovesfound)
{
val = -alphabetapvs(ply+1, depth-1, -alpha-1, -alpha);
if ((val > alpha) && (val < beta))
{
// in case of failure, proceed with normal alphabeta
val = -alphabetapvs(ply+1, depth - 1, -beta, -alpha);
}
}
// normal alphabeta
else val = -alphabetapvs(ply+1, depth-1, -beta, -alpha);
}
unmakeMove(moveBuffer[i]);Of course is just to show the idea. Any engine instead of trying depth-2 do variable reductions, and with more conditions.
Daniel José -
http://www.andscacs.com
-
vittyvirus
- Posts: 646
- Joined: Wed Jun 18, 2014 2:30 pm
- Full name: Fahad Syed
Re: What ply is depth-2?
Thank you! I'd try that soon...cdani wrote:Hi!
A very basic example of LMR in cheeser. I do not claim that it's any good.
So the idea is to try depth-2 and if it's good enough, don't try the standard depth-1.Code: Select all
bool dopvs=true; if (movesfound != 0 && depth>5 && !moveBuffer[i].getCapt() && !moveBuffer[i].isPromotion() && !moveBuffer[i].isCastle()) { val = -alphabetapvs(ply+1, depth-2, -alpha-1, -alpha); if (val <= alpha) { dopvs=false; } } inodes++; if (--countdown <=0) readClockAndInput(); movesfound++; if (!ply) displaySearchStats(3, ply, i); if (dopvs) { if (pvmovesfound) { val = -alphabetapvs(ply+1, depth-1, -alpha-1, -alpha); if ((val > alpha) && (val < beta)) { // in case of failure, proceed with normal alphabeta val = -alphabetapvs(ply+1, depth - 1, -beta, -alpha); } } // normal alphabeta else val = -alphabetapvs(ply+1, depth-1, -beta, -alpha); } unmakeMove(moveBuffer[i]);
Of course is just to show the idea. Any engine instead of trying depth-2 do variable reductions, and with more conditions.
-
Sven
- Posts: 4052
- Joined: Thu May 15, 2008 9:57 pm
- Location: Berlin, Germany
- Full name: Sven Schüle
Re: What ply is depth-2?
That's what I meant: no change of the 'ply' parameter value compared to non-reduced moves. If other moves are searched with ply+1 then of course also the reduced ones.kbhearn wrote:assuming 'ply' is the distance from the root, it should always be ply+1 to index the next entry in your arrays. no reductions or extensions should change this as you're always moving one move further from the root.