Hi,
I'm trying to add PVS to Embla.
I've added almost exact the code from
https://chessprogramming.wikispaces.com ... seudo Code
to it but to my surprise it lost almost 50 elo.
I've probably overlooked a - or + or something somewhere but I'm not seeing it.
Anyone willing to look at it?
All the code is available
https://github.com/flok99/Embla/tree/PVS
(Brain.cpp, method is ::search() )
regards
PVS & Embla
Moderators: hgm, Rebel, chrisw
-
- Posts: 931
- Joined: Tue Mar 09, 2010 3:46 pm
- Location: New York
- Full name: Álvaro Begué (RuyDos)
Re: PVS & Embla
If your transposition tables are working well, PVS should not lose Elo. I haven't read your code, but I can give you the pseudo-code for what I do.
Code: Select all
int negamax(Board &board, int alpha, int beta, int depth) {
if (depth <= 0)
return quiescence_search(board, alpha, beta);
for (int i = 0; i < board.n_moves(); ++i) {
board.make_move(i);
if (i > 0) {
int reduction = 0; // for now; you can implement LMR here
score = -negamax(-alpha-1, -alpha, depth - 1 - reduction);
if (score <= alpha) {
board.unmake_move();
continue;
}
if (score >= beta && reduction == 0)
goto DONE;
}
int score = -negamax(-alpha, -beta, depth - 1);
DONE:;
board.unmake_move();
if (score > alpha) {
alpha = score;
if (alpha >= beta)
break;
}
}
return alpha;
}
-
- Posts: 1756
- Joined: Tue Apr 19, 2016 6:08 am
- Location: U.S.A
- Full name: Andrew Grant
Re: PVS & Embla
Are you using fail-soft or fail-hard?
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
-
- Posts: 855
- Joined: Sun May 23, 2010 1:32 pm
Re: PVS & Embla
i think that line 1119 is wrong.
it should probably be :
because the search in the above line ha limits [alpha, alpha+1] and not [alpha,beta]
[/code]
Code: Select all
if (bSearchPV)
retry:
score = -search(sd, &m, depthLeft - 1 + extension, co, -beta, -alpha, newHash, curBestSiblings, false, &tempPv);
else {
score = -search(sd, &m, depthLeft - 1 + extension, co, -alpha - 1, -alpha, newHash, curBestSiblings, false, &tempPv);
!!! WRONG!!! if (score > alpha && score < beta) !!! WRONG!!!!!!
goto retry;
}
Code: Select all
if(val>alpha)
[/code]
Re: PVS & Embla
Fail soft: the returned score can be outside the bounds.AndrewGrant wrote:Are you using fail-soft or fail-hard?
regards
Re: PVS & Embla
I'm going to test that. I don't fully understand it because the wiki says that fail-soft should also check for score < beta?
-
- Posts: 276
- Joined: Sat Mar 04, 2017 12:24 pm
- Location: Hungary
Re: PVS & Embla
Hi flok!
I think, the biggest wasted time here:
add to
and
(root node = Pv node)
Try this by IID as well.
Your code is difficult to understand for me.
Try to clean the code and you'll notice where the bug is.
I think, the biggest wasted time here:
Code: Select all
if (useNm && !rootOfTree && nmDepth > 0 && !isCheck && !isNullMove)
Code: Select all
IS_PV = (beta != alpha + 1);
Code: Select all
if (!IS_PV && useNm && nmDepth > 0 && !isCheck && !isNullMove)
Try this by IID as well.
Your code is difficult to understand for me.
Try to clean the code and you'll notice where the bug is.
Re: PVS & Embla
That sounds interesting!
A quick TTD test showed no improvement (it got only slower) but maybe a longer run shows better results (I've started that).
thanks
A quick TTD test showed no improvement (it got only slower) but maybe a longer run shows better results (I've started that).
thanks
-
- Posts: 855
- Joined: Sun May 23, 2010 1:32 pm
Re: PVS & Embla
what version of GCC compiler are you using?
because I'm trying to copile it with the makefile you provide, but it doesn't work on my PC
because I'm trying to copile it with the makefile you provide, but it doesn't work on my PC
-
- Posts: 4052
- Joined: Thu May 15, 2008 9:57 pm
- Location: Berlin, Germany
- Full name: Sven Schüle
Re: PVS & Embla
According to the "Compare" function on github your branch "PVS" seems to have more diffs to the master branch than just the PVS change. This could explain the surprising results. Maybe you had checked out the wrong branch when making the "PVS" branch?flok wrote:https://github.com/flok99/Embla/tree/PVS