mirror of
https://github.com/sockspls/badfish
synced 2025-05-02 01:29:36 +00:00
Assorted code style of latest commits
No functional chnage.
This commit is contained in:
parent
61a6e46664
commit
6c42575208
3 changed files with 20 additions and 19 deletions
|
@ -498,25 +498,24 @@ namespace {
|
||||||
enum { Defended, Weak };
|
enum { Defended, Weak };
|
||||||
enum { Minor, Major };
|
enum { Minor, Major };
|
||||||
|
|
||||||
Bitboard b, weak, defended, safe_pawns, safe_pawn_threats, unsafe_pawn_threats;
|
Bitboard b, weak, defended, safeThreats;
|
||||||
Score score = SCORE_ZERO;
|
Score score = SCORE_ZERO;
|
||||||
|
|
||||||
// Pawn Threats
|
// Non-pawn enemies attacked by a pawn
|
||||||
b = ei.attackedBy[Us][PAWN] & (pos.pieces(Them) ^ pos.pieces(Them, PAWN));
|
weak = (pos.pieces(Them) ^ pos.pieces(Them, PAWN)) & ei.attackedBy[Us][PAWN];
|
||||||
|
|
||||||
if (b)
|
if (weak)
|
||||||
{
|
{
|
||||||
safe_pawns = pos.pieces(Us, PAWN) & (~ei.attackedBy[Them][ALL_PIECES] | ei.attackedBy[Us][ALL_PIECES]);
|
b = pos.pieces(Us, PAWN) & ( ~ei.attackedBy[Them][ALL_PIECES]
|
||||||
safe_pawn_threats = (shift_bb<Right>(safe_pawns) | shift_bb<Left>(safe_pawns)) & (pos.pieces(Them) ^ pos.pieces(Them, PAWN));
|
| ei.attackedBy[Us][ALL_PIECES]);
|
||||||
unsafe_pawn_threats = b ^ safe_pawn_threats;
|
|
||||||
|
|
||||||
// Unsafe pawn threats
|
safeThreats = (shift_bb<Right>(b) | shift_bb<Left>(b)) & weak;
|
||||||
if (unsafe_pawn_threats)
|
|
||||||
|
if (weak ^ safeThreats)
|
||||||
score += ThreatenedByHangingPawn;
|
score += ThreatenedByHangingPawn;
|
||||||
|
|
||||||
// Evaluate safe pawn threats
|
while (safeThreats)
|
||||||
while (safe_pawn_threats)
|
score += ThreatenedByPawn[type_of(pos.piece_on(pop_lsb(&safeThreats)))];
|
||||||
score += ThreatenedByPawn[type_of(pos.piece_on(pop_lsb(&safe_pawn_threats)))];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Non-pawn enemies defended by a pawn
|
// Non-pawn enemies defended by a pawn
|
||||||
|
|
|
@ -180,8 +180,10 @@ namespace {
|
||||||
// Score this pawn
|
// Score this pawn
|
||||||
if (isolated)
|
if (isolated)
|
||||||
score -= Isolated[opposed][f];
|
score -= Isolated[opposed][f];
|
||||||
|
|
||||||
else if (backward)
|
else if (backward)
|
||||||
score -= Backward[opposed][f];
|
score -= Backward[opposed][f];
|
||||||
|
|
||||||
else if (!supported)
|
else if (!supported)
|
||||||
score -= UnsupportedPawnPenalty;
|
score -= UnsupportedPawnPenalty;
|
||||||
|
|
||||||
|
|
|
@ -960,8 +960,9 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||||
|
|
||||||
if ( (!PvNode && cutNode)
|
if ( (!PvNode && cutNode)
|
||||||
|| History[pos.piece_on(to_sq(move))][to_sq(move)] < VALUE_ZERO
|
|| History[pos.piece_on(to_sq(move))][to_sq(move)] < VALUE_ZERO
|
||||||
|| CounterMovesHistory[pos.piece_on(prevMoveSq)][prevMoveSq][pos.piece_on(to_sq(move))][to_sq(move)]
|
|| ( History[pos.piece_on(to_sq(move))][to_sq(move)]
|
||||||
+ History[pos.piece_on(to_sq(move))][to_sq(move)] < VALUE_ZERO)
|
+ CounterMovesHistory[pos.piece_on(prevMoveSq)][prevMoveSq]
|
||||||
|
[pos.piece_on(to_sq(move))][to_sq(move)] < VALUE_ZERO))
|
||||||
ss->reduction += ONE_PLY;
|
ss->reduction += ONE_PLY;
|
||||||
|
|
||||||
if (move == countermoves[0] || move == countermoves[1])
|
if (move == countermoves[0] || move == countermoves[1])
|
||||||
|
@ -1432,11 +1433,10 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||||
cmh.update(pos.moved_piece(quiets[i]), to_sq(quiets[i]), -bonus);
|
cmh.update(pos.moved_piece(quiets[i]), to_sq(quiets[i]), -bonus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extra penalty for TT move in previous ply when it gets refuted
|
||||||
if (is_ok((ss-2)->currentMove) && (ss-1)->currentMove == (ss-1)->ttMove)
|
if (is_ok((ss-2)->currentMove) && (ss-1)->currentMove == (ss-1)->ttMove)
|
||||||
{
|
{
|
||||||
Square prevPrevSq = to_sq((ss-2)->currentMove);
|
Square prevPrevSq = to_sq((ss-2)->currentMove);
|
||||||
|
|
||||||
// Extra penalty for TT move in previous ply when it gets refuted
|
|
||||||
HistoryStats& ttMoveCmh = CounterMovesHistory[pos.piece_on(prevPrevSq)][prevPrevSq];
|
HistoryStats& ttMoveCmh = CounterMovesHistory[pos.piece_on(prevPrevSq)][prevPrevSq];
|
||||||
ttMoveCmh.update(pos.piece_on(prevSq), prevSq, -bonus - 2 * depth / ONE_PLY - 1);
|
ttMoveCmh.update(pos.piece_on(prevSq), prevSq, -bonus - 2 * depth / ONE_PLY - 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue