mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Sync with master
Bench: 7369224
This commit is contained in:
commit
0af24a1445
1 changed files with 13 additions and 8 deletions
|
@ -162,6 +162,7 @@ namespace {
|
|||
const Score Unstoppable = S( 0, 20);
|
||||
const Score Hanging = S(31, 26);
|
||||
const Score PawnAttackThreat = S(20, 20);
|
||||
const Score PawnSafePush = S( 5 , 5);
|
||||
|
||||
// Penalty for a bishop on a1/h1 (a8/h8 for black) which is trapped by
|
||||
// a friendly pawn on b2/g2 (b7/g7 for black). This can obviously only
|
||||
|
@ -545,14 +546,18 @@ namespace {
|
|||
score += more_than_one(b) ? KingOnMany : KingOnOne;
|
||||
}
|
||||
|
||||
// Add bonus for safe pawn pushes which attacks an enemy piece
|
||||
// Add a small bonus for safe pawn pushes
|
||||
b = pos.pieces(Us, PAWN) & ~TRank7BB;
|
||||
b = shift_bb<Up>(b | (shift_bb<Up>(b & TRank2BB) & ~pos.pieces()));
|
||||
|
||||
b &= ~pos.pieces()
|
||||
& ~ei.attackedBy[Them][PAWN]
|
||||
& (ei.attackedBy[Us][PAWN] | ~ei.attackedBy[Them][ALL_PIECES]);
|
||||
& (ei.attackedBy[Us][ALL_PIECES] | ~ei.attackedBy[Them][ALL_PIECES]);
|
||||
|
||||
if (b)
|
||||
score += popcount<Full>(b) * PawnSafePush;
|
||||
|
||||
// Add another bonus if the pawn push attacks an enemy piece
|
||||
b = (shift_bb<Left>(b) | shift_bb<Right>(b))
|
||||
& pos.pieces(Them)
|
||||
& ~ei.attackedBy[Us][PAWN];
|
||||
|
@ -899,14 +904,14 @@ namespace Eval {
|
|||
|
||||
void init() {
|
||||
|
||||
const double MaxSlope = 8.7;
|
||||
const double Peak = 1280;
|
||||
double t = 0.0;
|
||||
const int MaxSlope = 87;
|
||||
const int Peak = 12800;
|
||||
int t = 0;
|
||||
|
||||
for (int i = 1; i < 400; ++i)
|
||||
for (int i = 0; i < 400; ++i)
|
||||
{
|
||||
t = std::min(Peak, std::min(0.027 * i * i, t + MaxSlope));
|
||||
KingDanger[i] = apply_weight(make_score(int(t), 0), Weights[KingSafety]);
|
||||
t = std::min(Peak, std::min(i * i * 27 / 100, t + MaxSlope));
|
||||
KingDanger[i] = apply_weight(make_score(t / 10, 0), Weights[KingSafety]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue