mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 06:17:49 +00:00
Malus during move ordering for putting pieces en prise
The original idea is the reverse of a previous patch [1] which added bonuses in our move picker to moves escaping threats. In this patch, in addition to bonuses for evading threats, we apply penalties to moves moving to threatened squares. Further tweaks of that basic idea resulted in this specific version which further increases the penalty of moves moving to squares threatend depending on the piece threatening it. So for example a queen moving to a square attacked by a pawn would receive a larger penalty than a queen moving to square attacked by a rook. [1]: https://github.com/official-stockfish/Stockfish/commit/08e0f52b77edb929989c68c49e954b9bc5d7d67e -------- Passed STC: https://tests.stockfishchess.org/tests/live_elo/64c11269dc56e1650abb935d LLR: 2.94 (-2.94,2.94) <0.00,2.00> Total: 95552 W: 24654 L: 24250 D: 46648 Ptnml(0-2): 322, 11098, 24562, 11442, 352 Passed LTC: https://tests.stockfishchess.org/tests/live_elo/64c2004ddc56e1650abba8b3 LLR: 2.94 (-2.94,2.94) <0.50,2.50> Total: 190230 W: 48806 L: 48178 D: 93246 Ptnml(0-2): 90, 20439, 53453, 21019, 114 ------- closes https://github.com/official-stockfish/Stockfish/pull/4711 Bench: 1350831
This commit is contained in:
committed by
Stéphane Nicolet
parent
f84eb1f3ef
commit
65ece7d985
+37
-13
@@ -123,21 +123,45 @@ void MovePicker::score() {
|
|||||||
for (auto& m : *this)
|
for (auto& m : *this)
|
||||||
if constexpr (Type == CAPTURES)
|
if constexpr (Type == CAPTURES)
|
||||||
m.value = (7 * int(PieceValue[MG][pos.piece_on(to_sq(m))])
|
m.value = (7 * int(PieceValue[MG][pos.piece_on(to_sq(m))])
|
||||||
+ (*captureHistory)[pos.moved_piece(m)][to_sq(m)][type_of(pos.piece_on(to_sq(m)))]) / 16;
|
+ (*captureHistory)[pos.moved_piece(m)][to_sq(m)][type_of(pos.piece_on(to_sq(m)))]) / 16;
|
||||||
|
|
||||||
else if constexpr (Type == QUIETS)
|
else if constexpr (Type == QUIETS)
|
||||||
m.value = 2 * (*mainHistory)[pos.side_to_move()][from_to(m)]
|
{
|
||||||
+ 2 * (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)]
|
Piece pc = pos.moved_piece(m);
|
||||||
+ (*continuationHistory[1])[pos.moved_piece(m)][to_sq(m)]
|
PieceType pt = type_of(pos.moved_piece(m));
|
||||||
+ (*continuationHistory[3])[pos.moved_piece(m)][to_sq(m)]
|
Square from = from_sq(m);
|
||||||
+ (*continuationHistory[5])[pos.moved_piece(m)][to_sq(m)]
|
Square to = to_sq(m);
|
||||||
+ (threatenedPieces & from_sq(m) ?
|
|
||||||
(type_of(pos.moved_piece(m)) == QUEEN && !(to_sq(m) & threatenedByRook) ? 50000
|
// histories
|
||||||
: type_of(pos.moved_piece(m)) == ROOK && !(to_sq(m) & threatenedByMinor) ? 25000
|
m.value = 2 * (*mainHistory)[pos.side_to_move()][from_to(m)];
|
||||||
: !(to_sq(m) & threatenedByPawn) ? 15000
|
m.value += 2 * (*continuationHistory[0])[pc][to];
|
||||||
: 0)
|
m.value += (*continuationHistory[1])[pc][to];
|
||||||
: 0)
|
m.value += (*continuationHistory[3])[pc][to];
|
||||||
+ bool(pos.check_squares(type_of(pos.moved_piece(m))) & to_sq(m)) * 16384;
|
m.value += (*continuationHistory[5])[pc][to];
|
||||||
|
|
||||||
|
// bonus for checks
|
||||||
|
m.value += bool(pos.check_squares(pt) & to) * 16384;
|
||||||
|
|
||||||
|
// bonus for escaping from capture
|
||||||
|
m.value += threatenedPieces & from ?
|
||||||
|
(pt == QUEEN && !(to & threatenedByRook) ? 50000
|
||||||
|
: pt == ROOK && !(to & threatenedByMinor) ? 25000
|
||||||
|
: !(to & threatenedByPawn) ? 15000
|
||||||
|
: 0 )
|
||||||
|
: 0 ;
|
||||||
|
|
||||||
|
// malus for putting piece en prise
|
||||||
|
m.value -= !(threatenedPieces & from) ?
|
||||||
|
(pt == QUEEN ? bool(to & threatenedByRook) * 50000
|
||||||
|
+ bool(to & threatenedByMinor) * 10000
|
||||||
|
+ bool(to & threatenedByPawn) * 20000
|
||||||
|
: pt == ROOK ? bool(to & threatenedByMinor) * 25000
|
||||||
|
+ bool(to & threatenedByPawn) * 10000
|
||||||
|
: pt != PAWN ? bool(to & threatenedByPawn) * 15000
|
||||||
|
: 0 )
|
||||||
|
: 0 ;
|
||||||
|
}
|
||||||
|
|
||||||
else // Type == EVASIONS
|
else // Type == EVASIONS
|
||||||
{
|
{
|
||||||
if (pos.capture_stage(m))
|
if (pos.capture_stage(m))
|
||||||
|
|||||||
Reference in New Issue
Block a user