-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syntaxic sugar for Position::see_ge(move, threshold) #5529
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -986,7 +986,7 @@ Value Search::Worker::search( | |
|
||
// SEE based pruning for captures and checks (~11 Elo) | ||
int seeHist = std::clamp(captHist / 32, -182 * depth, 166 * depth); | ||
if (!pos.see_ge(move, -168 * depth - seeHist)) | ||
if (pos.see(move) < -168 * depth - seeHist) | ||
continue; | ||
} | ||
else | ||
|
@@ -1019,7 +1019,7 @@ Value Search::Worker::search( | |
lmrDepth = std::max(lmrDepth, 0); | ||
|
||
// Prune moves with negative SEE (~4 Elo) | ||
if (!pos.see_ge(move, -24 * lmrDepth * lmrDepth)) | ||
if (pos.see(move) < -24 * lmrDepth * lmrDepth) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@snicolet I'm referring to here, aren't we calling the function again on the move, if we are passing move to the function aren't we calculating the result for such move in this position.. is this call not redundant to the ones in the movepicker? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we save the result S. and reuse it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not a function, this is just syntaxic sugar...
is strictly equivalent to
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I see so it's like alpha-beta? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i.e. if a see_ge value fails high over +3000, is calculating see_ge of threshold -90000 relevant? |
||
continue; | ||
} | ||
} | ||
|
@@ -1566,15 +1566,15 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta) | |
|
||
// If static eval is much lower than alpha and move is | ||
// not winning material, we can prune this move. (~2 Elo) | ||
if (futilityBase <= alpha && !pos.see_ge(move, 1)) | ||
if (futilityBase <= alpha && pos.see(move) <= 0) | ||
{ | ||
bestValue = std::max(bestValue, futilityBase); | ||
continue; | ||
} | ||
|
||
// If static exchange evaluation is much worse than what | ||
// is needed to not fall below alpha, we can prune this move. | ||
if (futilityBase > alpha && !pos.see_ge(move, (alpha - futilityBase) * 4)) | ||
if (futilityBase > alpha && pos.see(move) < (alpha - futilityBase) * 4) | ||
{ | ||
bestValue = alpha; | ||
continue; | ||
|
@@ -1591,7 +1591,7 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta) | |
continue; | ||
|
||
// Do not search moves with bad enough SEE values (~5 Elo) | ||
if (!pos.see_ge(move, -83)) | ||
if (pos.see(move) < -83) | ||
continue; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing PR!
Now one question I wanted to ask for so long, is that for such moves, can't we save the see value into the move struct such that we reuse it when we want to prune?, the code in search looks like redundant work to me, IIUC that should be a (nice) speedup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there is no function in master (nor in this PR) to calculate the SEE value of a move, we can only compare that value to a lower bound via see_ge()