mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 17:19:36 +00:00
Move Pieces[] out of global visibility
It is an helper array used only in position.cpp Also small code tidy up while there. No functional change. Closes #1106
This commit is contained in:
parent
321a27fbe3
commit
25296547d0
3 changed files with 12 additions and 9 deletions
|
@ -52,6 +52,9 @@ namespace {
|
||||||
|
|
||||||
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
|
// 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
|
// 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.
|
// from the bitboards and scan for new X-ray attacks behind it.
|
||||||
|
|
|
@ -56,11 +56,12 @@ struct Stack {
|
||||||
struct RootMove {
|
struct RootMove {
|
||||||
|
|
||||||
explicit RootMove(Move m) : pv(1, m) {}
|
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 score = -VALUE_INFINITE;
|
||||||
Value previousScore = -VALUE_INFINITE;
|
Value previousScore = -VALUE_INFINITE;
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
# include <immintrin.h> // Header for _pext_u64() intrinsic
|
# include <immintrin.h> // Header for _pext_u64() intrinsic
|
||||||
# define pext(b, m) _pext_u64(b, m)
|
# define pext(b, m) _pext_u64(b, m)
|
||||||
#else
|
#else
|
||||||
# define pext(b, m) (0)
|
# define pext(b, m) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_POPCNT
|
#ifdef USE_POPCNT
|
||||||
|
@ -205,8 +205,6 @@ enum Piece {
|
||||||
PIECE_NB = 16
|
PIECE_NB = 16
|
||||||
};
|
};
|
||||||
|
|
||||||
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];
|
extern Value PieceValue[PHASE_NB][PIECE_NB];
|
||||||
|
|
||||||
enum Depth : int {
|
enum Depth : int {
|
||||||
|
@ -239,8 +237,8 @@ enum Square {
|
||||||
|
|
||||||
NORTH = 8,
|
NORTH = 8,
|
||||||
EAST = 1,
|
EAST = 1,
|
||||||
SOUTH = -8,
|
SOUTH = -NORTH,
|
||||||
WEST = -1,
|
WEST = -EAST,
|
||||||
|
|
||||||
NORTH_EAST = NORTH + EAST,
|
NORTH_EAST = NORTH + EAST,
|
||||||
SOUTH_EAST = SOUTH + EAST,
|
SOUTH_EAST = SOUTH + EAST,
|
||||||
|
@ -331,6 +329,7 @@ inline Score operator/(Score s, int i) {
|
||||||
|
|
||||||
/// Multiplication of a Score by an integer. We check for overflow in debug mode.
|
/// Multiplication of a Score by an integer. We check for overflow in debug mode.
|
||||||
inline Score operator*(Score s, int i) {
|
inline Score operator*(Score s, int i) {
|
||||||
|
|
||||||
Score result = Score(int(s) * i);
|
Score result = Score(int(s) * i);
|
||||||
|
|
||||||
assert(eg_value(result) == (i * eg_value(s)));
|
assert(eg_value(result) == (i * eg_value(s)));
|
||||||
|
|
Loading…
Add table
Reference in a new issue