mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Small trivial clean-ups, February 2021
Closes https://github.com/official-stockfish/Stockfish/pull/3329 No functional change
This commit is contained in:
parent
b46813f9b7
commit
40cb0f076a
5 changed files with 19 additions and 21 deletions
|
@ -1,7 +1,5 @@
|
||||||
# Stockfish, a UCI chess playing engine derived from Glaurung 2.1
|
# Stockfish, a UCI chess playing engine derived from Glaurung 2.1
|
||||||
# Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
|
# Copyright (C) 2004-2021 The Stockfish developers (see AUTHORS file)
|
||||||
# Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad
|
|
||||||
# Copyright (C) 2015-2019 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad
|
|
||||||
#
|
#
|
||||||
# Stockfish is free software: you can redistribute it and/or modify
|
# Stockfish is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -423,7 +423,6 @@ namespace {
|
||||||
score += BishopOnKingRing;
|
score += BishopOnKingRing;
|
||||||
|
|
||||||
int mob = popcount(b & mobilityArea[Us]);
|
int mob = popcount(b & mobilityArea[Us]);
|
||||||
|
|
||||||
mobility[Us] += MobilityBonus[Pt - 2][mob];
|
mobility[Us] += MobilityBonus[Pt - 2][mob];
|
||||||
|
|
||||||
if (Pt == BISHOP || Pt == KNIGHT)
|
if (Pt == BISHOP || Pt == KNIGHT)
|
||||||
|
|
|
@ -99,11 +99,11 @@ void MovePicker::score() {
|
||||||
static_assert(Type == CAPTURES || Type == QUIETS || Type == EVASIONS, "Wrong type");
|
static_assert(Type == CAPTURES || Type == QUIETS || Type == EVASIONS, "Wrong type");
|
||||||
|
|
||||||
for (auto& m : *this)
|
for (auto& m : *this)
|
||||||
if (Type == CAPTURES)
|
if constexpr (Type == CAPTURES)
|
||||||
m.value = int(PieceValue[MG][pos.piece_on(to_sq(m))]) * 6
|
m.value = int(PieceValue[MG][pos.piece_on(to_sq(m))]) * 6
|
||||||
+ (*captureHistory)[pos.moved_piece(m)][to_sq(m)][type_of(pos.piece_on(to_sq(m)))];
|
+ (*captureHistory)[pos.moved_piece(m)][to_sq(m)][type_of(pos.piece_on(to_sq(m)))];
|
||||||
|
|
||||||
else if (Type == QUIETS)
|
else if constexpr (Type == QUIETS)
|
||||||
m.value = (*mainHistory)[pos.side_to_move()][from_to(m)]
|
m.value = (*mainHistory)[pos.side_to_move()][from_to(m)]
|
||||||
+ 2 * (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)]
|
+ 2 * (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)]
|
||||||
+ (*continuationHistory[1])[pos.moved_piece(m)][to_sq(m)]
|
+ (*continuationHistory[1])[pos.moved_piece(m)][to_sq(m)]
|
||||||
|
|
|
@ -268,7 +268,7 @@ Position& Position::set(const string& fenStr, bool isChess960, StateInfo* si, Th
|
||||||
enpassant = pawn_attacks_bb(~sideToMove, st->epSquare) & pieces(sideToMove, PAWN)
|
enpassant = pawn_attacks_bb(~sideToMove, st->epSquare) & pieces(sideToMove, PAWN)
|
||||||
&& (pieces(~sideToMove, PAWN) & (st->epSquare + pawn_push(~sideToMove)))
|
&& (pieces(~sideToMove, PAWN) & (st->epSquare + pawn_push(~sideToMove)))
|
||||||
&& !(pieces() & (st->epSquare | (st->epSquare + pawn_push(sideToMove))))
|
&& !(pieces() & (st->epSquare | (st->epSquare + pawn_push(sideToMove))))
|
||||||
&& (file_of(square<KING>(sideToMove)) == file_of(st->epSquare)
|
&& ( file_of(square<KING>(sideToMove)) == file_of(st->epSquare)
|
||||||
|| !(blockers_for_king(sideToMove) & (st->epSquare + pawn_push(~sideToMove))));
|
|| !(blockers_for_king(sideToMove) & (st->epSquare + pawn_push(~sideToMove))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,8 +518,8 @@ bool Position::legal(Move m) const {
|
||||||
// st->previous->blockersForKing consider capsq as empty.
|
// st->previous->blockersForKing consider capsq as empty.
|
||||||
// If pinned, it has to move along the king ray.
|
// If pinned, it has to move along the king ray.
|
||||||
if (type_of(m) == EN_PASSANT)
|
if (type_of(m) == EN_PASSANT)
|
||||||
return !(st->previous->blockersForKing[sideToMove] & from) ||
|
return !(st->previous->blockersForKing[sideToMove] & from)
|
||||||
aligned(from, to, square<KING>(us));
|
|| aligned(from, to, square<KING>(us));
|
||||||
|
|
||||||
// Castling moves generation does not check if the castling path is clear of
|
// Castling moves generation does not check if the castling path is clear of
|
||||||
// enemy attacks, it is delayed at a later time: now!
|
// enemy attacks, it is delayed at a later time: now!
|
||||||
|
@ -657,7 +657,8 @@ bool Position::gives_check(Move m) const {
|
||||||
// So the King must be in the same rank as fromsq to consider this possibility.
|
// So the King must be in the same rank as fromsq to consider this possibility.
|
||||||
// st->previous->blockersForKing consider capsq as empty.
|
// st->previous->blockersForKing consider capsq as empty.
|
||||||
case EN_PASSANT:
|
case EN_PASSANT:
|
||||||
return st->previous->checkersBB || (rank_of(square<KING>(~sideToMove)) == rank_of(from)
|
return st->previous->checkersBB
|
||||||
|
|| ( rank_of(square<KING>(~sideToMove)) == rank_of(from)
|
||||||
&& st->previous->blockersForKing[~sideToMove] & from);
|
&& st->previous->blockersForKing[~sideToMove] & from);
|
||||||
|
|
||||||
default: //CASTLING
|
default: //CASTLING
|
||||||
|
|
|
@ -1181,7 +1181,7 @@ moves_loop: // When in check, search starts from here
|
||||||
r++;
|
r++;
|
||||||
|
|
||||||
// Decrease reduction if position is or has been on the PV
|
// Decrease reduction if position is or has been on the PV
|
||||||
// and node is not likely to fail low (~10 Elo)
|
// and node is not likely to fail low. (~10 Elo)
|
||||||
if (ss->ttPv && !likelyFailLow)
|
if (ss->ttPv && !likelyFailLow)
|
||||||
r -= 2;
|
r -= 2;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue