mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Reintroduce rook contact checks
Were removed when merged from Glaurung 2.2, but without any test. Note that weight has been increased from original 2 to 4 and has been also fixed a bug where in the original version were considered also diagonal sqaures for the rook, that are contact squares but not checks. After 4449 games at 30"+0.1 Mod - Orig: 717 - 649 - 3083 ELO +5 (+- 4.1) Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
4350d9e8a6
commit
dd8a076128
1 changed files with 19 additions and 0 deletions
|
@ -200,6 +200,7 @@ namespace {
|
|||
|
||||
// Bonuses for enemy's safe checks
|
||||
const int QueenContactCheckBonus = 6;
|
||||
const int RookContactCheckBonus = 4;
|
||||
const int QueenCheckBonus = 3;
|
||||
const int RookCheckBonus = 2;
|
||||
const int BishopCheckBonus = 1;
|
||||
|
@ -710,6 +711,24 @@ namespace {
|
|||
* (Them == pos.side_to_move() ? 2 : 1);
|
||||
}
|
||||
|
||||
// Analyse enemy's safe rook contact checks. First find undefended
|
||||
// squares around the king attacked by enemy rooks...
|
||||
b = undefended & ei.attackedBy[Them][ROOK] & ~pos.pieces_of_color(Them);
|
||||
|
||||
// Consider only squares where the enemy rook gives check
|
||||
b &= RookPseudoAttacks[ksq];
|
||||
|
||||
if (b)
|
||||
{
|
||||
// ...then remove squares not supported by another enemy piece
|
||||
b &= ( ei.attackedBy[Them][PAWN] | ei.attackedBy[Them][KNIGHT]
|
||||
| ei.attackedBy[Them][BISHOP] | ei.attackedBy[Them][QUEEN]);
|
||||
if (b)
|
||||
attackUnits += RookContactCheckBonus
|
||||
* count_1s_max_15<HasPopCnt>(b)
|
||||
* (Them == pos.side_to_move() ? 2 : 1);
|
||||
}
|
||||
|
||||
// Analyse enemy's safe distance checks for sliders and knights
|
||||
safe = ~(pos.pieces_of_color(Them) | ei.attackedBy[Us][0]);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue