Explicitly use delta psqt values when possible

Instead of add and subtract pqst values corrisponding to
the move starting and destination squares, do it in one
go with the helper function pst_delta<>()

This simplifies the code and also better documents that what
we need is a delta value, not an absolute one.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2009-06-28 05:56:58 +02:00
parent d9e3be4790
commit bbb2462576
3 changed files with 41 additions and 40 deletions

View File

@@ -268,20 +268,23 @@ void MovePicker::score_noncaptures() {
// 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;
Piece piece;
Square from, to;
int hs;
for (int i = 0; i < numOfMoves; i++)
{
m = moves[i].move;
hs = H.move_ordering_score(pos.piece_on(move_from(m)), move_to(m));
from = move_from(moves[i].move);
to = move_to(moves[i].move);
piece = pos.piece_on(from);
hs = H.move_ordering_score(piece, to);
// Ensure history is always preferred to pst
if (hs > 0)
hs += 1000;
// pst based scoring
moves[i].score = hs + pos.mg_pst_delta(m);
moves[i].score = hs + pos.pst_delta<Position::MidGame>(piece, from, to);
}
}