1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 16:53:09 +00:00

Small clean-up

Bench: 4321677
This commit is contained in:
Stéphane Nicolet 2021-03-24 21:55:49 +01:00
parent c489df6f5b
commit b862c8d4be
5 changed files with 24 additions and 20 deletions

View file

@ -1,4 +1,4 @@
# List of authors for Stockfish, as of March 24, 2021 # List of authors for Stockfish, as of March 31, 2021
# Founders of the Stockfish project and fishtest infrastructure # Founders of the Stockfish project and fishtest infrastructure
Tord Romstad (romstad) Tord Romstad (romstad)

View file

@ -242,9 +242,9 @@ When not using the Makefile to compile (for instance, with Microsoft MSVC) you
need to manually set/unset some switches in the compiler command line; see need to manually set/unset some switches in the compiler command line; see
file *types.h* for a quick reference. file *types.h* for a quick reference.
When reporting an issue or a bug, please tell us which version and When reporting an issue or a bug, please tell us which Stockfish version
compiler you used to create your executable. These informations can and which compiler you used to create your executable. This information
be found by typing the following commands in a console: can be found by typing the following command in a console:
``` ```
./stockfish compiler ./stockfish compiler
@ -252,8 +252,8 @@ be found by typing the following commands in a console:
## Understanding the code base and participating in the project ## Understanding the code base and participating in the project
Stockfish's improvement over the last couple of years has been a great Stockfish's improvement over the last decade has been a great community
community effort. There are a few ways to help contribute to its growth. effort. There are a few ways to help contribute to its growth.
### Donating hardware ### Donating hardware

View file

@ -212,6 +212,7 @@ constexpr Bitboard adjacent_files_bb(Square s) {
inline Bitboard line_bb(Square s1, Square s2) { inline Bitboard line_bb(Square s1, Square s2) {
assert(is_ok(s1) && is_ok(s2)); assert(is_ok(s1) && is_ok(s2));
return LineBB[s1][s2]; return LineBB[s1][s2];
} }
@ -225,7 +226,9 @@ inline Bitboard line_bb(Square s1, Square s2) {
/// interpose itself to cover the check or capture the checking piece. /// interpose itself to cover the check or capture the checking piece.
inline Bitboard between_bb(Square s1, Square s2) { inline Bitboard between_bb(Square s1, Square s2) {
assert(is_ok(s1) && is_ok(s2)); assert(is_ok(s1) && is_ok(s2));
return BetweenBB[s1][s2]; return BetweenBB[s1][s2];
} }

View file

@ -256,12 +256,12 @@ namespace {
S(0, 0), S(3, 44), S(37, 68), S(42, 60), S(0, 39), S(58, 43) S(0, 0), S(3, 44), S(37, 68), S(42, 60), S(0, 39), S(58, 43)
}; };
constexpr Value CorneredBishop = Value(50);
// Assorted bonuses and penalties // Assorted bonuses and penalties
constexpr Score UncontestedOutpost = S( 1, 10); constexpr Score UncontestedOutpost = S( 1, 10);
constexpr Score BishopOnKingRing = S( 24, 0); constexpr Score BishopOnKingRing = S( 24, 0);
constexpr Score BishopXRayPawns = S( 4, 5); constexpr Score BishopXRayPawns = S( 4, 5);
constexpr Value CorneredBishopV = Value(50);
constexpr Score CorneredBishop = S(CorneredBishopV, CorneredBishopV);
constexpr Score FlankAttacks = S( 8, 0); constexpr Score FlankAttacks = S( 8, 0);
constexpr Score Hanging = S( 69, 36); constexpr Score Hanging = S( 69, 36);
constexpr Score KnightOnQueen = S( 16, 11); constexpr Score KnightOnQueen = S( 16, 11);
@ -478,8 +478,8 @@ namespace {
{ {
Direction d = pawn_push(Us) + (file_of(s) == FILE_A ? EAST : WEST); Direction d = pawn_push(Us) + (file_of(s) == FILE_A ? EAST : WEST);
if (pos.piece_on(s + d) == make_piece(Us, PAWN)) if (pos.piece_on(s + d) == make_piece(Us, PAWN))
score -= !pos.empty(s + d + pawn_push(Us)) ? CorneredBishop * 4 score -= !pos.empty(s + d + pawn_push(Us)) ? 4 * make_score(CorneredBishop, CorneredBishop)
: CorneredBishop * 3; : 3 * make_score(CorneredBishop, CorneredBishop);
} }
} }
} }
@ -1052,23 +1052,23 @@ make_v:
if ( pos.piece_on(SQ_A1) == W_BISHOP if ( pos.piece_on(SQ_A1) == W_BISHOP
&& pos.piece_on(SQ_B2) == W_PAWN) && pos.piece_on(SQ_B2) == W_PAWN)
correction += !pos.empty(SQ_B3) ? -CorneredBishopV * 4 correction += !pos.empty(SQ_B3) ? -CorneredBishop * 4
: -CorneredBishopV * 3; : -CorneredBishop * 3;
if ( pos.piece_on(SQ_H1) == W_BISHOP if ( pos.piece_on(SQ_H1) == W_BISHOP
&& pos.piece_on(SQ_G2) == W_PAWN) && pos.piece_on(SQ_G2) == W_PAWN)
correction += !pos.empty(SQ_G3) ? -CorneredBishopV * 4 correction += !pos.empty(SQ_G3) ? -CorneredBishop * 4
: -CorneredBishopV * 3; : -CorneredBishop * 3;
if ( pos.piece_on(SQ_A8) == B_BISHOP if ( pos.piece_on(SQ_A8) == B_BISHOP
&& pos.piece_on(SQ_B7) == B_PAWN) && pos.piece_on(SQ_B7) == B_PAWN)
correction += !pos.empty(SQ_B6) ? CorneredBishopV * 4 correction += !pos.empty(SQ_B6) ? CorneredBishop * 4
: CorneredBishopV * 3; : CorneredBishop * 3;
if ( pos.piece_on(SQ_H8) == B_BISHOP if ( pos.piece_on(SQ_H8) == B_BISHOP
&& pos.piece_on(SQ_G7) == B_PAWN) && pos.piece_on(SQ_G7) == B_PAWN)
correction += !pos.empty(SQ_G6) ? CorneredBishopV * 4 correction += !pos.empty(SQ_G6) ? CorneredBishop * 4
: CorneredBishopV * 3; : CorneredBishop * 3;
return pos.side_to_move() == WHITE ? Value(correction) return pos.side_to_move() == WHITE ? Value(correction)
: -Value(correction); : -Value(correction);
@ -1119,7 +1119,8 @@ Value Eval::evaluate(const Position& pos) {
// If the classical eval is small and imbalance large, use NNUE nevertheless. // If the classical eval is small and imbalance large, use NNUE nevertheless.
// For the case of opposite colored bishops, switch to NNUE eval with // For the case of opposite colored bishops, switch to NNUE eval with
// small probability if the classical eval is less than the threshold. // small probability if the classical eval is less than the threshold.
if ( largePsq && !strongClassical if ( largePsq
&& !strongClassical
&& ( abs(v) * 16 < NNUEThreshold2 * r50 && ( abs(v) * 16 < NNUEThreshold2 * r50
|| ( pos.opposite_bishops() || ( pos.opposite_bishops()
&& abs(v) * 16 < (NNUEThreshold1 + pos.non_pawn_material() / 64) * r50 && abs(v) * 16 < (NNUEThreshold1 + pos.non_pawn_material() / 64) * r50