mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-24 02:57:11 +08:00
make DistanceRing more consistent
This is a non-functional change. By pre-incrementing minKingPawnDistance instead of post-incrementing, we can remove this -1. This also makes DistanceRing more consistent with the rest of stockfish since it now holds an actual "distance" instead of a less natural distance-1. In current master, PseudoAttacks[KING][ksq] == DistanceRingBB[ksq][0] With this patch, it will be PseudoAttacks[KING][ksq] == DistanceRingBB[ksq][1] ie squares at distance 1 from the king. This is more natural use of distance. The current array size DistanceRingBB[SQUARE_NB][8] is still OK with the new definition, because maximum distance between two squares on a chess board is seven (for example Kh1 and a8). No functional change.
This commit is contained in:
committed by
Stéphane Nicolet
parent
6307fd08e6
commit
8a4821923a
@@ -245,7 +245,7 @@ Score Entry::do_king_safety(const Position& pos, Square ksq) {
|
||||
|
||||
Bitboard pawns = pos.pieces(Us, PAWN);
|
||||
if (pawns)
|
||||
while (!(DistanceRingBB[ksq][minKingPawnDistance++] & pawns)) {}
|
||||
while (!(DistanceRingBB[ksq][++minKingPawnDistance] & pawns)) {}
|
||||
|
||||
Value bonus = evaluate_shelter<Us>(pos, ksq);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user