summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3913726)
Use in addition the counter move history table for sorting quiet
check evasion moves in main and quiecence search. Also rename
"contHistory" to "continuationHistory" while there.
STC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 73284 W: 16433 L: 15938 D: 40913
http://tests.stockfishchess.org/tests/view/
5b4f526e0ebc5902bdb7a401
LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 12135 W: 2171 L: 1997 D: 7967
http://tests.stockfishchess.org/tests/view/
5b4fc0ef0ebc5902bdb7ae0e
Closes https://github.com/official-stockfish/Stockfish/pull/1685
Bench
4817583
/// MovePicker constructor for the main search
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHistory* mh,
const CapturePieceToHistory* cph, const PieceToHistory** ch, Move cm, Move* killers)
/// MovePicker constructor for the main search
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHistory* mh,
const CapturePieceToHistory* cph, const PieceToHistory** ch, Move cm, Move* killers)
- : pos(p), mainHistory(mh), captureHistory(cph), contHistory(ch),
+ : pos(p), mainHistory(mh), captureHistory(cph), continuationHistory(ch),
refutations{{killers[0], 0}, {killers[1], 0}, {cm, 0}}, depth(d) {
assert(d > DEPTH_ZERO);
refutations{{killers[0], 0}, {killers[1], 0}, {cm, 0}}, depth(d) {
assert(d > DEPTH_ZERO);
/// MovePicker constructor for quiescence search
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHistory* mh,
/// MovePicker constructor for quiescence search
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHistory* mh,
- const CapturePieceToHistory* cph, Square rs)
- : pos(p), mainHistory(mh), captureHistory(cph), recaptureSquare(rs), depth(d) {
+ const CapturePieceToHistory* cph, const PieceToHistory** ch, Square rs)
+ : pos(p), mainHistory(mh), captureHistory(cph), continuationHistory(ch), recaptureSquare(rs), depth(d) {
else if (Type == QUIETS)
m.value = (*mainHistory)[pos.side_to_move()][from_to(m)]
else if (Type == QUIETS)
m.value = (*mainHistory)[pos.side_to_move()][from_to(m)]
- + (*contHistory[0])[pos.moved_piece(m)][to_sq(m)]
- + (*contHistory[1])[pos.moved_piece(m)][to_sq(m)]
- + (*contHistory[3])[pos.moved_piece(m)][to_sq(m)];
+ + (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)]
+ + (*continuationHistory[1])[pos.moved_piece(m)][to_sq(m)]
+ + (*continuationHistory[3])[pos.moved_piece(m)][to_sq(m)];
else // Type == EVASIONS
{
else // Type == EVASIONS
{
m.value = PieceValue[MG][pos.piece_on(to_sq(m))]
- Value(type_of(pos.moved_piece(m)));
else
m.value = PieceValue[MG][pos.piece_on(to_sq(m))]
- Value(type_of(pos.moved_piece(m)));
else
- m.value = (*mainHistory)[pos.side_to_move()][from_to(m)] - (1 << 28);
+ m.value = (*mainHistory)[pos.side_to_move()][from_to(m)]
+ + (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)]
+ - (1 << 28);
MovePicker(const Position&, Move, Value, const CapturePieceToHistory*);
MovePicker(const Position&, Move, Depth, const ButterflyHistory*,
const CapturePieceToHistory*,
MovePicker(const Position&, Move, Value, const CapturePieceToHistory*);
MovePicker(const Position&, Move, Depth, const ButterflyHistory*,
const CapturePieceToHistory*,
+ const PieceToHistory**,
Square);
MovePicker(const Position&, Move, Depth, const ButterflyHistory*,
const CapturePieceToHistory*,
Square);
MovePicker(const Position&, Move, Depth, const ButterflyHistory*,
const CapturePieceToHistory*,
const Position& pos;
const ButterflyHistory* mainHistory;
const CapturePieceToHistory* captureHistory;
const Position& pos;
const ButterflyHistory* mainHistory;
const CapturePieceToHistory* captureHistory;
- const PieceToHistory** contHistory;
+ const PieceToHistory** continuationHistory;
Move ttMove;
ExtMove refutations[3], *cur, *endMoves, *endBadCaptures;
int stage;
Move ttMove;
ExtMove refutations[3], *cur, *endMoves, *endBadCaptures;
int stage;
std::memset(ss-4, 0, 7 * sizeof(Stack));
for (int i = 4; i > 0; i--)
std::memset(ss-4, 0, 7 * sizeof(Stack));
for (int i = 4; i > 0; i--)
- (ss-i)->contHistory = this->contHistory[NO_PIECE][0].get(); // Use as sentinel
+ (ss-i)->continuationHistory = this->continuationHistory[NO_PIECE][0].get(); // Use as sentinel
bestValue = delta = alpha = -VALUE_INFINITE;
beta = VALUE_INFINITE;
bestValue = delta = alpha = -VALUE_INFINITE;
beta = VALUE_INFINITE;
(ss+1)->ply = ss->ply + 1;
ss->currentMove = (ss+1)->excludedMove = bestMove = MOVE_NONE;
(ss+1)->ply = ss->ply + 1;
ss->currentMove = (ss+1)->excludedMove = bestMove = MOVE_NONE;
- ss->contHistory = thisThread->contHistory[NO_PIECE][0].get();
+ ss->continuationHistory = thisThread->continuationHistory[NO_PIECE][0].get();
(ss+2)->killers[0] = (ss+2)->killers[1] = MOVE_NONE;
Square prevSq = to_sq((ss-1)->currentMove);
(ss+2)->killers[0] = (ss+2)->killers[1] = MOVE_NONE;
Square prevSq = to_sq((ss-1)->currentMove);
Depth R = ((823 + 67 * depth / ONE_PLY) / 256 + std::min((eval - beta) / PawnValueMg, 3)) * ONE_PLY;
ss->currentMove = MOVE_NULL;
Depth R = ((823 + 67 * depth / ONE_PLY) / 256 + std::min((eval - beta) / PawnValueMg, 3)) * ONE_PLY;
ss->currentMove = MOVE_NULL;
- ss->contHistory = thisThread->contHistory[NO_PIECE][0].get();
+ ss->continuationHistory = thisThread->continuationHistory[NO_PIECE][0].get();
probCutCount++;
ss->currentMove = move;
probCutCount++;
ss->currentMove = move;
- ss->contHistory = thisThread->contHistory[pos.moved_piece(move)][to_sq(move)].get();
+ ss->continuationHistory = thisThread->continuationHistory[pos.moved_piece(move)][to_sq(move)].get();
assert(depth >= 5 * ONE_PLY);
assert(depth >= 5 * ONE_PLY);
moves_loop: // When in check, search starts from here
moves_loop: // When in check, search starts from here
- const PieceToHistory* contHist[] = { (ss-1)->contHistory, (ss-2)->contHistory, nullptr, (ss-4)->contHistory };
+ const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory, nullptr, (ss-4)->continuationHistory };
Move countermove = thisThread->counterMoves[pos.piece_on(prevSq)][prevSq];
MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory,
Move countermove = thisThread->counterMoves[pos.piece_on(prevSq)][prevSq];
MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory,
// Update the current move (this must be done after singular extension search)
ss->currentMove = move;
// Update the current move (this must be done after singular extension search)
ss->currentMove = move;
- ss->contHistory = thisThread->contHistory[movedPiece][to_sq(move)].get();
+ ss->continuationHistory = thisThread->continuationHistory[movedPiece][to_sq(move)].get();
// Step 15. Make the move
pos.do_move(move, st, givesCheck);
// Step 15. Make the move
pos.do_move(move, st, givesCheck);
+ Thread* thisThread = pos.this_thread();
(ss+1)->ply = ss->ply + 1;
ss->currentMove = bestMove = MOVE_NONE;
(ss+1)->ply = ss->ply + 1;
ss->currentMove = bestMove = MOVE_NONE;
+ ss->continuationHistory = thisThread->continuationHistory[NO_PIECE][0].get();
inCheck = pos.checkers();
moveCount = 0;
inCheck = pos.checkers();
moveCount = 0;
futilityBase = bestValue + 128;
}
futilityBase = bestValue + 128;
}
+ const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory, nullptr, (ss-4)->continuationHistory };
+
// Initialize a MovePicker object for the current position, and prepare
// to search the moves. Because the depth is <= 0 here, only captures,
// queen promotions and checks (only if depth >= DEPTH_QS_CHECKS) will
// be generated.
// Initialize a MovePicker object for the current position, and prepare
// to search the moves. Because the depth is <= 0 here, only captures,
// queen promotions and checks (only if depth >= DEPTH_QS_CHECKS) will
// be generated.
- MovePicker mp(pos, ttMove, depth, &pos.this_thread()->mainHistory,
- &pos.this_thread()->captureHistory,
+ MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory,
+ &thisThread->captureHistory,
+ contHist,
to_sq((ss-1)->currentMove));
// Loop through the moves until no moves remain or a beta cutoff occurs
to_sq((ss-1)->currentMove));
// Loop through the moves until no moves remain or a beta cutoff occurs
}
ss->currentMove = move;
}
ss->currentMove = move;
+ ss->continuationHistory = thisThread->continuationHistory[pos.moved_piece(move)][to_sq(move)].get();
// Make and search the move
pos.do_move(move, st, givesCheck);
// Make and search the move
pos.do_move(move, st, givesCheck);
for (int i : {1, 2, 4})
if (is_ok((ss-i)->currentMove))
for (int i : {1, 2, 4})
if (is_ok((ss-i)->currentMove))
- (*(ss-i)->contHistory)[pc][to] << bonus;
+ (*(ss-i)->continuationHistory)[pc][to] << bonus;
- PieceToHistory* contHistory;
+ PieceToHistory* continuationHistory;
int ply;
Move currentMove;
Move excludedMove;
int ply;
Move currentMove;
Move excludedMove;
mainHistory.fill(0);
captureHistory.fill(0);
mainHistory.fill(0);
captureHistory.fill(0);
- for (auto& to : contHistory)
+ for (auto& to : continuationHistory)
for (auto& h : to)
h.get()->fill(0);
for (auto& h : to)
h.get()->fill(0);
- contHistory[NO_PIECE][0].get()->fill(Search::CounterMovePruneThreshold - 1);
+ continuationHistory[NO_PIECE][0].get()->fill(Search::CounterMovePruneThreshold - 1);
}
/// Thread::start_searching() wakes up the thread that will start the search
}
/// Thread::start_searching() wakes up the thread that will start the search
CounterMoveHistory counterMoves;
ButterflyHistory mainHistory;
CapturePieceToHistory captureHistory;
CounterMoveHistory counterMoves;
ButterflyHistory mainHistory;
CapturePieceToHistory captureHistory;
- ContinuationHistory contHistory;
+ ContinuationHistory continuationHistory;