Introduce Counter Move History tables

Introduce a counter move history table which additionally is indexed by the last move's piece and target square.
For quiet move ordering use now the sum of standard and counter move history table.

STC:
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 4747 W: 1005 L: 885 D: 2857

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,6.00]
Total: 5726 W: 1001 L: 872 D: 3853

Because of reported low NPS on multi core test
STC (7 threads):
ELO: 7.26 +-3.3 (95%) LOS: 100.0%
Total: 14937 W: 2710 L: 2398 D: 9829

Bench: 7725341

Resolves #282
This commit is contained in:
Stefan Geschwentner
2015-03-12 07:29:57 +00:00
committed by Joona Kiiski
parent 81c7975dcd
commit 13c11f4048
3 changed files with 33 additions and 14 deletions

View File

@@ -67,8 +67,8 @@ namespace {
/// search captures, promotions and some checks) and how important good move
/// ordering is at the current node.
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h,
Move* cm, Move* fm, Search::Stack* s) : pos(p), history(h), depth(d) {
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h, const CounterMovesHistoryStats& cmh,
Move* cm, Move* fm, Search::Stack* s) : pos(p), history(h), counterMovesHistory(cmh), depth(d) {
assert(d > DEPTH_ZERO);
@@ -87,8 +87,8 @@ 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,
Square s) : pos(p), history(h) {
MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const HistoryStats& h, const CounterMovesHistoryStats& cmh,
Square s) : pos(p), history(h), counterMovesHistory(cmh) {
assert(d <= DEPTH_ZERO);
@@ -112,8 +112,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, PieceType pt)
: pos(p), history(h) {
MovePicker::MovePicker(const Position& p, Move ttm, const HistoryStats& h, const CounterMovesHistoryStats& cmh, PieceType pt)
: pos(p), history(h), counterMovesHistory(cmh) {
assert(!pos.checkers());
@@ -162,8 +162,13 @@ void MovePicker::score<CAPTURES>() {
template<>
void MovePicker::score<QUIETS>() {
Square prevMoveSq = to_sq((ss-1)->currentMove);
Piece prevMovePiece = pos.piece_on(prevMoveSq);
const HistoryStats &cmh = counterMovesHistory[prevMovePiece][prevMoveSq];
for (auto& m : *this)
m.value = history[pos.moved_piece(m)][to_sq(m)];
m.value = history[pos.moved_piece(m)][to_sq(m)]
+ cmh[pos.moved_piece(m)][to_sq(m)];
}
template<>