mirror of
https://github.com/sockspls/badfish
synced 2025-05-02 09:39: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 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.
|
||||
|
|
|
@ -56,11 +56,12 @@ struct Stack {
|
|||
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 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;
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
# include <immintrin.h> // Header for _pext_u64() intrinsic
|
||||
# define pext(b, m) _pext_u64(b, m)
|
||||
#else
|
||||
# define pext(b, m) (0)
|
||||
# define pext(b, m) 0
|
||||
#endif
|
||||
|
||||
#ifdef USE_POPCNT
|
||||
|
@ -205,8 +205,6 @@ enum Piece {
|
|||
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];
|
||||
|
||||
enum Depth : int {
|
||||
|
@ -239,8 +237,8 @@ enum Square {
|
|||
|
||||
NORTH = 8,
|
||||
EAST = 1,
|
||||
SOUTH = -8,
|
||||
WEST = -1,
|
||||
SOUTH = -NORTH,
|
||||
WEST = -EAST,
|
||||
|
||||
NORTH_EAST = NORTH + 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.
|
||||
inline Score operator*(Score s, int i) {
|
||||
|
||||
Score result = Score(int(s) * i);
|
||||
|
||||
assert(eg_value(result) == (i * eg_value(s)));
|
||||
|
|
Loading…
Add table
Reference in a new issue