Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ namespace {
|| (pos.pieces(PAWN) & (s + Up)))
bonus = bonus / 2;

score += bonus - PassedFile * std::min(f, ~f);
score += bonus - PassedFile * map_to_queenside(f);
}

if (T)
Expand Down
2 changes: 1 addition & 1 deletion src/pawns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ Score Entry::evaluate_shelter(const Position& pos, Square ksq) {
b = theirPawns & file_bb(f);
int theirRank = b ? relative_rank(Us, frontmost_sq(Them, b)) : 0;

int d = std::min(f, ~f);
File d = map_to_queenside(f);
bonus += make_score(ShelterStrength[d][ourRank], 0);

if (ourRank && (ourRank == theirRank - 1))
Expand Down
2 changes: 1 addition & 1 deletion src/psqt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void init() {

for (Square s = SQ_A1; s <= SQ_H8; ++s)
{
File f = std::min(file_of(s), ~file_of(s));
File f = map_to_queenside(file_of(s));
psq[ pc][ s] = score + (type_of(pc) == PAWN ? PBonus[rank_of(s)][file_of(s)]
: Bonus[pc][rank_of(s)][f]);
psq[~pc][~s] = -psq[pc][s];
Expand Down
6 changes: 4 additions & 2 deletions src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <climits>
#include <cstdint>
#include <cstdlib>
#include <algorithm>

#if defined(_MSC_VER)
// Disable some silly and noisy warning from MSVC compiler
Expand Down Expand Up @@ -358,8 +359,8 @@ constexpr Square operator~(Square s) {
return Square(s ^ SQ_A8); // Vertical flip SQ_A1 -> SQ_A8
}

constexpr File operator~(File f) {
return File(f ^ FILE_H); // Horizontal flip FILE_A -> FILE_H
inline File map_to_queenside(File f) {
return std::min(f, File(FILE_H - f)); // Maps File ABCDEFGH to File ABCDDCBA
}

constexpr Piece operator~(Piece pc) {
Expand Down Expand Up @@ -461,3 +462,4 @@ constexpr bool is_ok(Move m) {
}

#endif // #ifndef TYPES_H_INCLUDED