From 88885399f4a8bdc579c2b75cd892e78821631c63 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sun, 26 Oct 2008 13:44:34 +0100 Subject: [PATCH 1/1] Reintroduce piece/square tables to score non-captures Was removed after original movepick restore. But proved to be useful. Signed-off-by: Marco Costalba --- src/movepick.cpp | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) 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); } } -- 2.39.2