From: Marco Costalba Date: Sun, 26 Oct 2008 12:44:34 +0000 (+0100) Subject: Reintroduce piece/square tables to score non-captures X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=88885399f4a8bdc579c2b75cd892e78821631c63;hp=a5c1b3e8f68a9c98e6be1f90e7d0295d05c685de Reintroduce piece/square tables to score non-captures Was removed after original movepick restore. But proved to be useful. Signed-off-by: Marco Costalba --- diff --git a/src/movepick.cpp b/src/movepick.cpp index 68f03a30..2867e766 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -226,16 +226,28 @@ void MovePicker::score_captures() { } void MovePicker::score_noncaptures() { - - for (int i = 0; i < numOfMoves; i++) - { - Move m = moves[i].move; - if (m == killer1) - moves[i].score = HistoryMax + 2; - else if (m == killer2) - moves[i].score = HistoryMax + 1; - else - moves[i].score = H.move_ordering_score(pos.piece_on(move_from(m)), m); + // First score by history, when no history is available then use + // piece/square tables values. This seems to be better then a + // random choice when we don't have an history for any move. + Move m; + int hs; + + for (int i = 0; i < numOfMoves; i++) + { + m = moves[i].move; + + if (m == killer1) + hs = HistoryMax + 2; + else if (m == killer2) + hs = HistoryMax + 1; + else + hs = H.move_ordering_score(pos.piece_on(move_from(m)), m); + + // Ensure moves in history are always sorted as first + if (hs > 0) + hs += 1000; + + moves[i].score = hs + pos.mg_pst_delta(m); } }