Skip to content
Permalink
Browse files
Bonus for rook/queen attacking pawns on same rank
Patch and tuning by Gary Linscott from an idea of Ryan Taker.

Double tested by Gary:

Wins: 3390 Losses: 2972 Draws: 11323
LOS: 99.999992%
ELO: 8.213465 +- 99%: 6.746506 95%: 5.124415
Win%: 51.181792 +- 99%: 0.969791 95%: 0.736740

And by me:

After 5612 games 1255  1085  3271 +11 ELO
  • Loading branch information
glinscott authored and mcostalba committed Sep 21, 2012
1 parent 09acdac commit fdbe800
Showing 1 changed file with 20 additions and 10 deletions.
@@ -138,7 +138,7 @@ namespace {
{}, {},
{ S(0, 0), S( 7, 39), S( 0, 0), S(24, 49), S(41,100), S(41,100) }, // KNIGHT
{ S(0, 0), S( 7, 39), S(24, 49), S( 0, 0), S(41,100), S(41,100) }, // BISHOP
{ S(0, 0), S(-1, 29), S(15, 49), S(15, 49), S( 0, 0), S(24, 49) }, // ROOK
{ S(0, 0), S( 0, 22), S(15, 49), S(15, 49), S( 0, 0), S(24, 49) }, // ROOK
{ S(0, 0), S(15, 39), S(15, 39), S(15, 39), S(15, 39), S( 0, 0) } // QUEEN
};

@@ -153,12 +153,16 @@ namespace {
// Bonus for having the side to move (modified by Joona Kiiski)
const Score Tempo = make_score(24, 11);

// Rooks and queens on the 7th rank (modified by Joona Kiiski)
const Score RookOn7thBonus = make_score(47, 98);
const Score QueenOn7thBonus = make_score(27, 54);
// Rooks and queens on the 7th rank
const Score RookOn7thBonus = make_score(3, 20);
const Score QueenOn7thBonus = make_score(1, 8);

// Rooks and queens attacking pawns on the same rank
const Score RookOnPawnBonus = make_score(3, 48);
const Score QueenOnPawnBonus = make_score(1, 40);

// Rooks on open files (modified by Joona Kiiski)
const Score RookOpenFileBonus = make_score(43, 21);
const Score RookOpenFileBonus = make_score(43, 21);
const Score RookHalfOpenFileBonus = make_score(19, 10);

// Penalty for rooks trapped inside a friendly king which has lost the
@@ -595,12 +599,18 @@ Value do_evaluate(const Position& pos, Value& margin) {
&& !(pos.pieces(Them, PAWN) & attack_span_mask(Us, s)))
score += evaluate_outposts<Piece, Us>(pos, ei, s);

// Queen or rook on 7th rank
if ( (Piece == ROOK || Piece == QUEEN)
&& relative_rank(Us, s) == RANK_7
&& relative_rank(Us, pos.king_square(Them)) == RANK_8)
if ((Piece == ROOK || Piece == QUEEN) && relative_rank(Us, s) >= RANK_5)
{
score += (Piece == ROOK ? RookOn7thBonus : QueenOn7thBonus);
// Major piece on 7th rank
if ( relative_rank(Us, s) == RANK_7
&& relative_rank(Us, pos.king_square(Them)) == RANK_8)
score += (Piece == ROOK ? RookOn7thBonus : QueenOn7thBonus);

// Major piece attacking pawns on the same rank
Bitboard pawns = pos.pieces(Them, PAWN) & rank_bb(s);
if (pawns)
score += (Piece == ROOK ? RookOnPawnBonus
: QueenOnPawnBonus) * popcount<Max15>(pawns);
}

// Special extra evaluation for bishops

1 comment on commit fdbe800

@RyanTaker
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to do what this project was originally intended for - replacing the seventh rank bonus entirely. In my mind, one would just increase the pawn bonus amount and the bonus for sudo-attacks against the king from the queen and rook. It would take some time to get it right though.

Please sign in to comment.