mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Simplify kingRing
Simplify the king ring initialization and make it more regular, by just moving the king square off the edges and using PseudoAttacks by king from this new square. There is a small functional difference from the previous master, as the old master excludes the original ksq square while this patch always includes the nine squares block (after moving the king from the edges). Additionally, master does not adjust the kingRing down if we are on relative rank 8, while this patch treats all of the edges the same. STC LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 13263 W: 2968 L: 2830 D: 7465 http://tests.stockfishchess.org/tests/view/5db872830ebc5902d1f388aa LTC LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 72996 W: 11819 L: 11780 D: 49397 http://tests.stockfishchess.org/tests/view/5db899c20ebc5902d1f38b5e Closes https://github.com/official-stockfish/Stockfish/pull/2384 Bench: 4959244
This commit is contained in:
parent
6f3796adaf
commit
e8fca71342
1 changed files with 3 additions and 9 deletions
|
@ -235,15 +235,9 @@ namespace {
|
|||
attackedBy2[Us] = dblAttackByPawn | (attackedBy[Us][KING] & attackedBy[Us][PAWN]);
|
||||
|
||||
// Init our king safety tables
|
||||
kingRing[Us] = attackedBy[Us][KING];
|
||||
if (relative_rank(Us, ksq) == RANK_1)
|
||||
kingRing[Us] |= shift<Up>(kingRing[Us]);
|
||||
|
||||
if (file_of(ksq) == FILE_H)
|
||||
kingRing[Us] |= shift<WEST>(kingRing[Us]);
|
||||
|
||||
else if (file_of(ksq) == FILE_A)
|
||||
kingRing[Us] |= shift<EAST>(kingRing[Us]);
|
||||
Square s = make_square(clamp(file_of(ksq), FILE_B, FILE_G),
|
||||
clamp(rank_of(ksq), RANK_2, RANK_7));
|
||||
kingRing[Us] = PseudoAttacks[KING][s] | s;
|
||||
|
||||
kingAttackersCount[Them] = popcount(kingRing[Us] & pe->pawn_attacks(Them));
|
||||
kingAttacksCount[Them] = kingAttackersWeight[Them] = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue