Here is a loss by Hansel which stumped me.
Hansel has Q-Search and the following evaluation features:
1. Material weights
2. Piece square table weights
3. Penalty for double pawns and Isolated pawns.
4. Bonus for passed pawns.
5. Attackers near king's ring (x-rays passing through rooks and queens)
6. Tapered evaluation (stockfish's ideas and almost the code),
Just to try out, following is being used. Please note this is an older version
Code: Select all
while (bbWhiteQueenBlack > 0)
{
int sqFrom = Utilities.bitscan_forward(bbWhiteQueenBlack);
ulong occupancyQueenBishop = ~Defs.BB_EMPTY;
occupancyQueenBishop &= MagicBitBoards.BISHOP_ATTACK_INNER_MASK[sqFrom];
occupancyQueenBishop *= MagicBitBoards.BishopMagic[sqFrom];
occupancyQueenBishop >>= 64 - MagicBitBoards.BitForBishopAttack[sqFrom];
ulong movesQueenAttackingKingRing = (MagicBitBoards.BishopAttacks[sqFrom, occupancyQueenBishop] & occupancyPiecesBlack) & kingRingWhite;
queenAttackersBlack += Utilities.count_bits(movesQueenAttackingKingRing);
ulong occupancyQueenRook = ~Defs.BB_EMPTY;
occupancyQueenRook &= MagicBitBoards.ROOKS_ATTACK_INNER_MASK[sqFrom];
occupancyQueenRook *= MagicBitBoards.RookMagic[sqFrom];
occupancyQueenRook >>= 64 - MagicBitBoards.BitForRookAttack[sqFrom];
ulong movesQueenRookAttackingKingRing = (MagicBitBoards.RookAttacks[sqFrom, occupancyQueenRook] & occupancyPiecesBlack) & kingRingWhite;
queenAttackersBlack += Utilities.count_bits(movesQueenRookAttackingKingRing);
bbWhiteQueenBlack &= bbWhiteQueenBlack - 1;
}
// Compute the difference.
int whiteAttackCount = 2 * queenAttackers + 3 * rookAttackers + 4 * bishopAttackers;
int blackAttackCount = 2 * queenAttackersBlack + 3 * rookAttackersBlack + 4 * bishopAttackersBlack;
What stumped me was it was seeing the position as +3.. and from there on it went to lose. From the game, it was quiet evident to play 38. Bc4 and almost after few captures, White gets a passed d-pawn and is winning.
Can somebody explain which feature I need to correct / add to avoid this loss.