mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Rename pawn chain to connected
The flag raises also in case of a pawn duo, i.e. when we have two adjacent pawns on the same rank, and not only in case of a chain, i.e. when the two pawns are on a diagonal line. See this for a reference: http://en.wikipedia.org/wiki/Connected_pawns Renaming suggested by Ralph. No functional change.
This commit is contained in:
parent
9b1d594456
commit
c5d478b923
1 changed files with 19 additions and 19 deletions
|
@ -49,8 +49,8 @@ namespace {
|
|||
{ S(20, 28), S(29, 31), S(33, 31), S(33, 31),
|
||||
S(33, 31), S(33, 31), S(29, 31), S(20, 28) } };
|
||||
|
||||
// Pawn chain membership bonus by file and rank (initialized by formula)
|
||||
Score ChainMember[FILE_NB][RANK_NB];
|
||||
// Connected pawn bonus by file and rank (initialized by formula)
|
||||
Score Connected[FILE_NB][RANK_NB];
|
||||
|
||||
// Candidate passed pawn bonus by rank
|
||||
const Score CandidatePassed[RANK_NB] = {
|
||||
|
@ -89,7 +89,7 @@ namespace {
|
|||
Bitboard b;
|
||||
Square s;
|
||||
File f;
|
||||
bool passed, isolated, doubled, opposed, chain, backward, candidate;
|
||||
bool passed, isolated, doubled, opposed, connected, backward, candidate;
|
||||
Score value = SCORE_ZERO;
|
||||
const Square* pl = pos.list<PAWN>(Us);
|
||||
|
||||
|
@ -113,22 +113,22 @@ namespace {
|
|||
// This file cannot be semi-open
|
||||
e->semiopenFiles[Us] &= ~(1 << f);
|
||||
|
||||
// Our rank plus previous one. Used for chain detection
|
||||
// Our rank plus previous one
|
||||
b = rank_bb(s) | rank_bb(s - pawn_push(Us));
|
||||
|
||||
// Flag the pawn as passed, isolated, doubled or member of a pawn
|
||||
// chain (but not the backward one).
|
||||
chain = ourPawns & adjacent_files_bb(f) & b;
|
||||
isolated = !(ourPawns & adjacent_files_bb(f));
|
||||
doubled = ourPawns & forward_bb(Us, s);
|
||||
opposed = theirPawns & forward_bb(Us, s);
|
||||
passed = !(theirPawns & passed_pawn_mask(Us, s));
|
||||
// Flag the pawn as passed, isolated, doubled or
|
||||
// connected (but not the backward one).
|
||||
connected = ourPawns & adjacent_files_bb(f) & b;
|
||||
isolated = !(ourPawns & adjacent_files_bb(f));
|
||||
doubled = ourPawns & forward_bb(Us, s);
|
||||
opposed = theirPawns & forward_bb(Us, s);
|
||||
passed = !(theirPawns & passed_pawn_mask(Us, s));
|
||||
|
||||
// Test for backward pawn.
|
||||
// If the pawn is passed, isolated, or member of a pawn chain it cannot
|
||||
// be backward. If there are friendly pawns behind on adjacent files
|
||||
// If the pawn is passed, isolated, or connected it cannot be
|
||||
// backward. If there are friendly pawns behind on adjacent files
|
||||
// or if it can capture an enemy pawn it cannot be backward either.
|
||||
if ( (passed | isolated | chain)
|
||||
if ( (passed | isolated | connected)
|
||||
|| (ourPawns & pawn_attack_span(Them, s))
|
||||
|| (pos.attacks_from<PAWN>(s, Us) & theirPawns))
|
||||
backward = false;
|
||||
|
@ -172,8 +172,8 @@ namespace {
|
|||
if (backward)
|
||||
value -= Backward[opposed][f];
|
||||
|
||||
if (chain)
|
||||
value += ChainMember[f][relative_rank(Us, s)];
|
||||
if (connected)
|
||||
value += Connected[f][relative_rank(Us, s)];
|
||||
|
||||
if (candidate)
|
||||
{
|
||||
|
@ -203,14 +203,14 @@ namespace Pawns {
|
|||
|
||||
void init() {
|
||||
|
||||
const int chainByFile[8] = { 1, 3, 3, 4, 4, 3, 3, 1 };
|
||||
const int bonusesByFile[8] = { 1, 3, 3, 4, 4, 3, 3, 1 };
|
||||
int bonus;
|
||||
|
||||
for (Rank r = RANK_1; r < RANK_8; ++r)
|
||||
for (File f = FILE_A; f <= FILE_H; ++f)
|
||||
{
|
||||
bonus = r * (r-1) * (r-2) + chainByFile[f] * (r/2 + 1);
|
||||
ChainMember[f][r] = make_score(bonus, bonus);
|
||||
bonus = r * (r-1) * (r-2) + bonusesByFile[f] * (r/2 + 1);
|
||||
Connected[f][r] = make_score(bonus, bonus);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue