mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Consolidate pawn_push and up
This is a non-functional simplification. Pawn_push and Up are redundant. If we make up pawn_push, we can use it for all of the Up's and Down's. In this version, I've also left the Up and Down constants so that there is no worse readability. STC LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 23878 W: 5202 L: 5085 D: 13591 http://tests.stockfishchess.org/tests/view/5db5569a0ebc5902d6b14de4 Closes https://github.com/official-stockfish/Stockfish/pull/2378 No functional change
This commit is contained in:
parent
1725ed39ad
commit
6f3796adaf
3 changed files with 8 additions and 8 deletions
|
@ -213,8 +213,8 @@ namespace {
|
||||||
void Evaluation<T>::initialize() {
|
void Evaluation<T>::initialize() {
|
||||||
|
|
||||||
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
|
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
|
||||||
constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH);
|
constexpr Direction Up = pawn_push(Us);
|
||||||
constexpr Direction Down = (Us == WHITE ? SOUTH : NORTH);
|
constexpr Direction Down = -Up;
|
||||||
constexpr Bitboard LowRanks = (Us == WHITE ? Rank2BB | Rank3BB : Rank7BB | Rank6BB);
|
constexpr Bitboard LowRanks = (Us == WHITE ? Rank2BB | Rank3BB : Rank7BB | Rank6BB);
|
||||||
|
|
||||||
const Square ksq = pos.square<KING>(Us);
|
const Square ksq = pos.square<KING>(Us);
|
||||||
|
@ -258,7 +258,7 @@ namespace {
|
||||||
Score Evaluation<T>::pieces() {
|
Score Evaluation<T>::pieces() {
|
||||||
|
|
||||||
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
|
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
|
||||||
constexpr Direction Down = (Us == WHITE ? SOUTH : NORTH);
|
constexpr Direction Down = -pawn_push(Us);
|
||||||
constexpr Bitboard OutpostRanks = (Us == WHITE ? Rank4BB | Rank5BB | Rank6BB
|
constexpr Bitboard OutpostRanks = (Us == WHITE ? Rank4BB | Rank5BB | Rank6BB
|
||||||
: Rank5BB | Rank4BB | Rank3BB);
|
: Rank5BB | Rank4BB | Rank3BB);
|
||||||
const Square* pl = pos.squares<Pt>(Us);
|
const Square* pl = pos.squares<Pt>(Us);
|
||||||
|
@ -484,7 +484,7 @@ namespace {
|
||||||
Score Evaluation<T>::threats() const {
|
Score Evaluation<T>::threats() const {
|
||||||
|
|
||||||
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
|
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
|
||||||
constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH);
|
constexpr Direction Up = pawn_push(Us);
|
||||||
constexpr Bitboard TRank3BB = (Us == WHITE ? Rank3BB : Rank6BB);
|
constexpr Bitboard TRank3BB = (Us == WHITE ? Rank3BB : Rank6BB);
|
||||||
|
|
||||||
Bitboard b, weak, defended, nonPawnEnemies, stronglyProtected, safe;
|
Bitboard b, weak, defended, nonPawnEnemies, stronglyProtected, safe;
|
||||||
|
@ -578,7 +578,7 @@ namespace {
|
||||||
Score Evaluation<T>::passed() const {
|
Score Evaluation<T>::passed() const {
|
||||||
|
|
||||||
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
|
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
|
||||||
constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH);
|
constexpr Direction Up = pawn_push(Us);
|
||||||
|
|
||||||
auto king_proximity = [&](Color c, Square s) {
|
auto king_proximity = [&](Color c, Square s) {
|
||||||
return std::min(distance(pos.square<KING>(c), s), 5);
|
return std::min(distance(pos.square<KING>(c), s), 5);
|
||||||
|
@ -669,7 +669,7 @@ namespace {
|
||||||
return SCORE_ZERO;
|
return SCORE_ZERO;
|
||||||
|
|
||||||
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
|
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
|
||||||
constexpr Direction Down = (Us == WHITE ? SOUTH : NORTH);
|
constexpr Direction Down = -pawn_push(Us);
|
||||||
constexpr Bitboard SpaceMask =
|
constexpr Bitboard SpaceMask =
|
||||||
Us == WHITE ? CenterFiles & (Rank2BB | Rank3BB | Rank4BB)
|
Us == WHITE ? CenterFiles & (Rank2BB | Rank3BB | Rank4BB)
|
||||||
: CenterFiles & (Rank7BB | Rank6BB | Rank5BB);
|
: CenterFiles & (Rank7BB | Rank6BB | Rank5BB);
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace {
|
||||||
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
|
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
|
||||||
constexpr Bitboard TRank7BB = (Us == WHITE ? Rank7BB : Rank2BB);
|
constexpr Bitboard TRank7BB = (Us == WHITE ? Rank7BB : Rank2BB);
|
||||||
constexpr Bitboard TRank3BB = (Us == WHITE ? Rank3BB : Rank6BB);
|
constexpr Bitboard TRank3BB = (Us == WHITE ? Rank3BB : Rank6BB);
|
||||||
constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH);
|
constexpr Direction Up = pawn_push(Us);
|
||||||
constexpr Direction UpRight = (Us == WHITE ? NORTH_EAST : SOUTH_WEST);
|
constexpr Direction UpRight = (Us == WHITE ? NORTH_EAST : SOUTH_WEST);
|
||||||
constexpr Direction UpLeft = (Us == WHITE ? NORTH_WEST : SOUTH_EAST);
|
constexpr Direction UpLeft = (Us == WHITE ? NORTH_WEST : SOUTH_EAST);
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace {
|
||||||
Score evaluate(const Position& pos, Pawns::Entry* e) {
|
Score evaluate(const Position& pos, Pawns::Entry* e) {
|
||||||
|
|
||||||
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
|
constexpr Color Them = (Us == WHITE ? BLACK : WHITE);
|
||||||
constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH);
|
constexpr Direction Up = pawn_push(Us);
|
||||||
|
|
||||||
Bitboard neighbours, stoppers, support, phalanx, opposed;
|
Bitboard neighbours, stoppers, support, phalanx, opposed;
|
||||||
Bitboard lever, leverPush, blocked;
|
Bitboard lever, leverPush, blocked;
|
||||||
|
|
Loading…
Add table
Reference in a new issue