It is an helper array used only in position.cpp
Also small code tidy up while there.
No functional change.
Closes #1106
const string PieceToChar(" PNBRQK pnbrqk");
const string PieceToChar(" PNBRQK pnbrqk");
+const Piece Pieces[] = { W_PAWN, W_KNIGHT, W_BISHOP, W_ROOK, W_QUEEN, W_KING,
+ B_PAWN, B_KNIGHT, B_BISHOP, B_ROOK, B_QUEEN, B_KING };
+
// min_attacker() is a helper function used by see_ge() to locate the least
// valuable attacker for the side to move, remove the attacker we just found
// from the bitboards and scan for new X-ray attacks behind it.
// min_attacker() is a helper function used by see_ge() to locate the least
// valuable attacker for the side to move, remove the attacker we just found
// from the bitboards and scan for new X-ray attacks behind it.
struct RootMove {
explicit RootMove(Move m) : pv(1, m) {}
struct RootMove {
explicit RootMove(Move m) : pv(1, m) {}
-
- bool operator<(const RootMove& m) const {
- return m.score != score ? m.score < score : m.previousScore < previousScore; } // Descending sort
- bool operator==(const Move& m) const { return pv[0] == m; }
bool extract_ponder_from_tt(Position& pos);
bool extract_ponder_from_tt(Position& pos);
+ bool operator==(const Move& m) const { return pv[0] == m; }
+ bool operator<(const RootMove& m) const { // Sort in descending order
+ return m.score != score ? m.score < score
+ : m.previousScore < previousScore;
+ }
Value score = -VALUE_INFINITE;
Value previousScore = -VALUE_INFINITE;
Value score = -VALUE_INFINITE;
Value previousScore = -VALUE_INFINITE;
# include <immintrin.h> // Header for _pext_u64() intrinsic
# define pext(b, m) _pext_u64(b, m)
#else
# include <immintrin.h> // Header for _pext_u64() intrinsic
# define pext(b, m) _pext_u64(b, m)
#else
-const Piece Pieces[] = { W_PAWN, W_KNIGHT, W_BISHOP, W_ROOK, W_QUEEN, W_KING,
- B_PAWN, B_KNIGHT, B_BISHOP, B_ROOK, B_QUEEN, B_KING };
extern Value PieceValue[PHASE_NB][PIECE_NB];
enum Depth : int {
extern Value PieceValue[PHASE_NB][PIECE_NB];
enum Depth : int {
- SOUTH = -8,
- WEST = -1,
+ SOUTH = -NORTH,
+ WEST = -EAST,
NORTH_EAST = NORTH + EAST,
SOUTH_EAST = SOUTH + EAST,
NORTH_EAST = NORTH + EAST,
SOUTH_EAST = SOUTH + EAST,
/// Multiplication of a Score by an integer. We check for overflow in debug mode.
inline Score operator*(Score s, int i) {
/// Multiplication of a Score by an integer. We check for overflow in debug mode.
inline Score operator*(Score s, int i) {
Score result = Score(int(s) * i);
assert(eg_value(result) == (i * eg_value(s)));
Score result = Score(int(s) * i);
assert(eg_value(result) == (i * eg_value(s)));