X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmovepick.cpp;h=b82e68b66a8019160998e7c0880c71ef58bbac2a;hp=b3f413bf1ffa0bd20255ccd5f25893839dfd1e45;hb=13d4df95cd4c56c0e730328648de54d9ed8bd81e;hpb=098f645d26675bcf2180b290be77fe64a63de3ae diff --git a/src/movepick.cpp b/src/movepick.cpp index b3f413bf..b82e68b6 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -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() { template<> void MovePicker::score() { + + 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)]; + m.value = history[pos.moved_piece(m)][to_sq(m)] + + cmh[pos.moved_piece(m)][to_sq(m)]; } template<>