Cleanup history stats

And other assorted trivia.

No functional change.
This commit is contained in:
Marco Costalba
2015-10-24 07:27:24 +02:00
parent 55758344d3
commit 307a5a4f63
8 changed files with 114 additions and 112 deletions

View File

@@ -68,8 +68,8 @@ namespace {
/// ordering is at the current node.
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h,
const CounterMovesHistoryStats& cmh, Move cm, Search::Stack* s)
: pos(p), history(h), counterMovesHistory(cmh), ss(s), countermove(cm), depth(d) {
const CounterMovesStats& cmh, Move cm, Search::Stack* s)
: pos(p), history(h), counterMovesHistory(&cmh), ss(s), countermove(cm), depth(d) {
assert(d > DEPTH_ZERO);
@@ -78,9 +78,9 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats&
endMoves += (ttMove != MOVE_NONE);
}
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h,
const CounterMovesHistoryStats& cmh, Square s)
: pos(p), history(h), counterMovesHistory(cmh) {
MovePicker::MovePicker(const Position& p, Move ttm, Depth d,
const HistoryStats& h, Square s)
: pos(p), history(h), counterMovesHistory(nullptr) {
assert(d <= DEPTH_ZERO);
@@ -104,9 +104,8 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats&
endMoves += (ttMove != MOVE_NONE);
}
MovePicker::MovePicker(const Position& p, Move ttm, const HistoryStats& h,
const CounterMovesHistoryStats& cmh, Value th)
: pos(p), history(h), counterMovesHistory(cmh), threshold(th) {
MovePicker::MovePicker(const Position& p, Move ttm, const HistoryStats& h, Value th)
: pos(p), history(h), counterMovesHistory(nullptr), threshold(th) {
assert(!pos.checkers());
@@ -141,12 +140,9 @@ void MovePicker::score<CAPTURES>() {
template<>
void MovePicker::score<QUIETS>() {
Square prevSq = to_sq((ss-1)->currentMove);
const HistoryStats& cmh = counterMovesHistory[pos.piece_on(prevSq)][prevSq];
for (auto& m : *this)
m.value = history[pos.moved_piece(m)][to_sq(m)]
+ cmh[pos.moved_piece(m)][to_sq(m)];
+ (*counterMovesHistory)[pos.moved_piece(m)][to_sq(m)];
}
template<>