Skip to content

Commit

Permalink
Bonus for pushing pawns towards promotion in the endgame (#2)
Browse files Browse the repository at this point in the history
ELO | 38.38 +- 11.94 (95%)
SPRT | 20.0+0.20s Threads=1 Hash=64MB
LLR | 2.97 (-2.94, 2.94) [0.00, 3.00]
GAMES | N: 2872 W: 1407 L: 1091 D: 374

Bench: 7856921
  • Loading branch information
Dannyj1 authored Jan 16, 2023
1 parent 5189ff2 commit aa69f52
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions search_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,23 @@ namespace Zagreus {
}
}

uint64_t pawnBB = bitboard.getPieceBoard(PieceType::WHITE_PAWN + color);

while (pawnBB) {
int index = bitscanForward(pawnBB);
int fileNumber = index % 8;
int promotionSquare = (color == PieceColor::WHITE) ? 56 + fileNumber : fileNumber;
uint64_t tilesBetween = bitboard.getTilesBetween(index, promotionSquare);

if (color == PieceColor::WHITE) {
evalContext.whiteEndgameScore -= popcnt(tilesBetween) * 10;
} else {
evalContext.blackEndgameScore -= popcnt(tilesBetween) * 10;
}

pawnBB &= ~(1ULL << index);
}

if (color == PieceColor::WHITE) {
evalContext.whiteMidgameScore += score;
evalContext.whiteEndgameScore += score;
Expand Down

0 comments on commit aa69f52

Please sign in to comment.