1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Use SearchStack to pass excludedMove

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2010-06-02 13:22:48 +01:00
parent 2572055c87
commit 5804bef824
2 changed files with 12 additions and 5 deletions

View file

@ -285,7 +285,7 @@ namespace {
Value root_search(Position& pos, SearchStack* ss, RootMoveList& rml, Value* alphaPtr, Value* betaPtr);
template <NodeType PvNode>
Value search(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth, bool allowNullmove, int threadID, Move excludedMove = MOVE_NONE);
Value search(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth, bool allowNullmove, int threadID);
template <NodeType PvNode>
Value qsearch(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth, int threadID);
@ -1032,7 +1032,7 @@ namespace {
template <NodeType PvNode>
Value search(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth,
bool allowNullmove, int threadID, Move excludedMove) {
bool allowNullmove, int threadID) {
assert(alpha >= -VALUE_INFINITE && alpha <= VALUE_INFINITE);
assert(beta > alpha && beta <= VALUE_INFINITE);
@ -1044,7 +1044,8 @@ namespace {
EvalInfo ei;
StateInfo st;
const TTEntry* tte;
Move ttMove, move;
Key posKey;
Move ttMove, move, excludedMove;
Depth ext, newDepth;
Value bestValue, value, oldAlpha;
Value refinedValue, nullValue, futilityValueScaled; // Non-PV specific
@ -1058,6 +1059,7 @@ namespace {
// Step 1. Initialize node and poll. Polling can abort search
TM.incrementNodeCounter(threadID);
ss->init(ply);
(ss + 1)->excludedMove = MOVE_NONE;
(ss + 2)->initKillers();
if (threadID == 0 && ++NodesSincePoll > NodesBetweenPolls)
@ -1083,7 +1085,8 @@ namespace {
// We don't want the score of a partial search to overwrite a previous full search
// TT value, so we use a different position key in case of an excluded move exists.
Key posKey = excludedMove ? pos.get_exclusion_key() : pos.get_key();
excludedMove = ss->excludedMove;
posKey = excludedMove ? pos.get_exclusion_key() : pos.get_key();
tte = TT.retrieve(posKey);
ttMove = (tte ? tte->move() : MOVE_NONE);
@ -1263,7 +1266,9 @@ namespace {
if (abs(ttValue) < VALUE_KNOWN_WIN)
{
Value b = ttValue - SingularExtensionMargin;
Value v = search<NonPV>(pos, ss, b - 1, b, depth / 2, false, threadID, move);
ss->excludedMove = move;
Value v = search<NonPV>(pos, ss, b - 1, b, depth / 2, false, threadID);
ss->excludedMove = MOVE_NONE;
if (v < ttValue - SingularExtensionMargin)
ext = OnePly;
@ -2221,6 +2226,7 @@ namespace {
{
ss->init(i);
ss->initKillers();
ss->excludedMove = MOVE_NONE;
}
}

View file

@ -54,6 +54,7 @@ struct SearchStack {
Move currentMove;
Move mateKiller;
Move threatMove;
Move excludedMove;
Move killers[KILLER_MAX];
Depth reduction;
Value eval;