Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak the formulas for unsafeSquares #3268

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,12 +791,14 @@ namespace {
unsafeSquares &= attackedBy[Them][ALL_PIECES] | pos.pieces(Them);

// If there are no enemy pieces or attacks on passed pawn span, assign a big bonus.
// Or if there is some, but they are all attacked by our pawns, assign a bit smaller bonus.
// Otherwise assign a smaller bonus if the path to queen is not attacked
// and even smaller bonus if it is attacked but block square is not.
int k = !unsafeSquares ? 35 :
!(unsafeSquares & squaresToQueen) ? 20 :
!(unsafeSquares & blockSq) ? 9 :
0 ;

int k = !unsafeSquares ? 36 :
!(unsafeSquares & ~attackedBy[Us][PAWN]) ? 30 :
!(unsafeSquares & squaresToQueen) ? 17 :
!(unsafeSquares & blockSq) ? 7 :
FauziAkram marked this conversation as resolved.
Show resolved Hide resolved

// Assign a larger bonus if the block square is defended
if ((pos.pieces(Us) & bb) || (attackedBy[Us][ALL_PIECES] & blockSq))
Expand Down