mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Introduce bestMove to store PV move
No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
eb48c54687
commit
0a687b2cf0
2 changed files with 10 additions and 9 deletions
|
@ -368,7 +368,7 @@ void init_search() {
|
||||||
// Called at the beginning of search() when starting to examine a new node.
|
// Called at the beginning of search() when starting to examine a new node.
|
||||||
void SearchStack::init() {
|
void SearchStack::init() {
|
||||||
|
|
||||||
pv[0] = pv[1] = MOVE_NONE;
|
pv[0] = pv[1] = bestMove = MOVE_NONE;
|
||||||
currentMove = threatMove = MOVE_NONE;
|
currentMove = threatMove = MOVE_NONE;
|
||||||
reduction = Depth(0);
|
reduction = Depth(0);
|
||||||
eval = VALUE_NONE;
|
eval = VALUE_NONE;
|
||||||
|
@ -1247,7 +1247,7 @@ namespace {
|
||||||
search<PvNode>(pos, ss, alpha, beta, d, ply);
|
search<PvNode>(pos, ss, alpha, beta, d, ply);
|
||||||
ss->skipNullMove = false;
|
ss->skipNullMove = false;
|
||||||
|
|
||||||
ttMove = ss->pv[0];
|
ttMove = ss->bestMove;
|
||||||
tte = TT.retrieve(posKey);
|
tte = TT.retrieve(posKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1444,7 +1444,7 @@ namespace {
|
||||||
return bestValue;
|
return bestValue;
|
||||||
|
|
||||||
ValueType f = (bestValue <= oldAlpha ? VALUE_TYPE_UPPER : bestValue >= beta ? VALUE_TYPE_LOWER : VALUE_TYPE_EXACT);
|
ValueType f = (bestValue <= oldAlpha ? VALUE_TYPE_UPPER : bestValue >= beta ? VALUE_TYPE_LOWER : VALUE_TYPE_EXACT);
|
||||||
move = (bestValue <= oldAlpha ? MOVE_NONE : ss->pv[0]);
|
move = (bestValue <= oldAlpha ? MOVE_NONE : ss->bestMove);
|
||||||
TT.store(posKey, value_to_tt(bestValue, ply), f, depth, move, ss->eval, ei.kingDanger[pos.side_to_move()]);
|
TT.store(posKey, value_to_tt(bestValue, ply), f, depth, move, ss->eval, ei.kingDanger[pos.side_to_move()]);
|
||||||
|
|
||||||
// Update killers and history only for non capture moves that fails high
|
// Update killers and history only for non capture moves that fails high
|
||||||
|
@ -1487,7 +1487,7 @@ namespace {
|
||||||
Value oldAlpha = alpha;
|
Value oldAlpha = alpha;
|
||||||
|
|
||||||
TM.incrementNodeCounter(pos.thread());
|
TM.incrementNodeCounter(pos.thread());
|
||||||
ss->pv[0] = ss->pv[1] = ss->currentMove = MOVE_NONE;
|
ss->pv[0] = ss->pv[1] = ss->bestMove = ss->currentMove = MOVE_NONE;
|
||||||
ss->eval = VALUE_NONE;
|
ss->eval = VALUE_NONE;
|
||||||
|
|
||||||
// Check for an instant draw or maximum ply reached
|
// Check for an instant draw or maximum ply reached
|
||||||
|
@ -1627,12 +1627,12 @@ namespace {
|
||||||
// Update transposition table
|
// Update transposition table
|
||||||
Depth d = (depth == Depth(0) ? Depth(0) : Depth(-1));
|
Depth d = (depth == Depth(0) ? Depth(0) : Depth(-1));
|
||||||
ValueType f = (bestValue <= oldAlpha ? VALUE_TYPE_UPPER : bestValue >= beta ? VALUE_TYPE_LOWER : VALUE_TYPE_EXACT);
|
ValueType f = (bestValue <= oldAlpha ? VALUE_TYPE_UPPER : bestValue >= beta ? VALUE_TYPE_LOWER : VALUE_TYPE_EXACT);
|
||||||
TT.store(pos.get_key(), value_to_tt(bestValue, ply), f, d, ss->pv[0], ss->eval, ei.kingDanger[pos.side_to_move()]);
|
TT.store(pos.get_key(), value_to_tt(bestValue, ply), f, d, ss->bestMove, ss->eval, ei.kingDanger[pos.side_to_move()]);
|
||||||
|
|
||||||
// Update killers only for checking moves that fails high
|
// Update killers only for checking moves that fails high
|
||||||
if ( bestValue >= beta
|
if ( bestValue >= beta
|
||||||
&& !pos.move_is_capture_or_promotion(ss->pv[0]))
|
&& !pos.move_is_capture_or_promotion(ss->bestMove))
|
||||||
update_killers(ss->pv[0], ss);
|
update_killers(ss->bestMove, ss);
|
||||||
|
|
||||||
assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
|
assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
|
||||||
|
|
||||||
|
@ -1816,7 +1816,7 @@ namespace {
|
||||||
Move* src = (ss+1)->pv;
|
Move* src = (ss+1)->pv;
|
||||||
Move* dst = ss->pv;
|
Move* dst = ss->pv;
|
||||||
|
|
||||||
*dst = ss->currentMove;
|
*dst = ss->bestMove = ss->currentMove;
|
||||||
|
|
||||||
do
|
do
|
||||||
*++dst = *src;
|
*++dst = *src;
|
||||||
|
@ -1834,7 +1834,7 @@ namespace {
|
||||||
Move* dst = ss->pv;
|
Move* dst = ss->pv;
|
||||||
Move* pdst = pss->pv;
|
Move* pdst = pss->pv;
|
||||||
|
|
||||||
*dst = *pdst = ss->currentMove;
|
*dst = *pdst = pss->bestMove = ss->bestMove = ss->currentMove;
|
||||||
|
|
||||||
do
|
do
|
||||||
*++dst = *++pdst = *src;
|
*++dst = *++pdst = *src;
|
||||||
|
|
|
@ -55,6 +55,7 @@ struct SearchStack {
|
||||||
Move mateKiller;
|
Move mateKiller;
|
||||||
Move threatMove;
|
Move threatMove;
|
||||||
Move excludedMove;
|
Move excludedMove;
|
||||||
|
Move bestMove;
|
||||||
Move killers[KILLER_MAX];
|
Move killers[KILLER_MAX];
|
||||||
Depth reduction;
|
Depth reduction;
|
||||||
Value eval;
|
Value eval;
|
||||||
|
|
Loading…
Add table
Reference in a new issue