1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33: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); Value root_search(Position& pos, SearchStack* ss, RootMoveList& rml, Value* alphaPtr, Value* betaPtr);
template <NodeType PvNode> 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> template <NodeType PvNode>
Value qsearch(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth, int threadID); Value qsearch(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth, int threadID);
@ -1032,7 +1032,7 @@ namespace {
template <NodeType PvNode> template <NodeType PvNode>
Value search(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth, 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(alpha >= -VALUE_INFINITE && alpha <= VALUE_INFINITE);
assert(beta > alpha && beta <= VALUE_INFINITE); assert(beta > alpha && beta <= VALUE_INFINITE);
@ -1044,7 +1044,8 @@ namespace {
EvalInfo ei; EvalInfo ei;
StateInfo st; StateInfo st;
const TTEntry* tte; const TTEntry* tte;
Move ttMove, move; Key posKey;
Move ttMove, move, excludedMove;
Depth ext, newDepth; Depth ext, newDepth;
Value bestValue, value, oldAlpha; Value bestValue, value, oldAlpha;
Value refinedValue, nullValue, futilityValueScaled; // Non-PV specific Value refinedValue, nullValue, futilityValueScaled; // Non-PV specific
@ -1058,6 +1059,7 @@ namespace {
// Step 1. Initialize node and poll. Polling can abort search // Step 1. Initialize node and poll. Polling can abort search
TM.incrementNodeCounter(threadID); TM.incrementNodeCounter(threadID);
ss->init(ply); ss->init(ply);
(ss + 1)->excludedMove = MOVE_NONE;
(ss + 2)->initKillers(); (ss + 2)->initKillers();
if (threadID == 0 && ++NodesSincePoll > NodesBetweenPolls) 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 // 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. // 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); tte = TT.retrieve(posKey);
ttMove = (tte ? tte->move() : MOVE_NONE); ttMove = (tte ? tte->move() : MOVE_NONE);
@ -1263,7 +1266,9 @@ namespace {
if (abs(ttValue) < VALUE_KNOWN_WIN) if (abs(ttValue) < VALUE_KNOWN_WIN)
{ {
Value b = ttValue - SingularExtensionMargin; 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) if (v < ttValue - SingularExtensionMargin)
ext = OnePly; ext = OnePly;
@ -2221,6 +2226,7 @@ namespace {
{ {
ss->init(i); ss->init(i);
ss->initKillers(); ss->initKillers();
ss->excludedMove = MOVE_NONE;
} }
} }

View file

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