Change NO_PIECE value and shrink PieceValue[]

This requires changing color_of() definition.

No functional change.
This commit is contained in:
Marco Costalba
2012-10-21 11:49:05 +02:00
parent e304db9d1e
commit e40b06a050
4 changed files with 24 additions and 25 deletions

View File

@@ -148,7 +148,8 @@ enum CastlingSide {
enum Phase {
PHASE_ENDGAME = 0,
PHASE_MIDGAME = 128
PHASE_MIDGAME = 128,
MG = 0, EG = 1, PHASE_NB = 2
};
enum ScaleFactor {
@@ -179,8 +180,6 @@ enum Value {
VALUE_ENSURE_INTEGER_SIZE_P = INT_MAX,
VALUE_ENSURE_INTEGER_SIZE_N = INT_MIN,
Mg = 0, Eg = 1,
PawnValueMg = 198, PawnValueEg = 258,
KnightValueMg = 817, KnightValueEg = 846,
BishopValueMg = 836, BishopValueEg = 857,
@@ -195,7 +194,7 @@ enum PieceType {
};
enum Piece {
NO_PIECE = 16, // color_of(NO_PIECE) == NO_COLOR
NO_PIECE = 0,
W_PAWN = 1, W_KNIGHT = 2, W_BISHOP = 3, W_ROOK = 4, W_QUEEN = 5, W_KING = 6,
B_PAWN = 9, B_KNIGHT = 10, B_BISHOP = 11, B_ROOK = 12, B_QUEEN = 13, B_KING = 14,
PIECE_NB = 16
@@ -347,7 +346,7 @@ namespace Zobrist {
CACHE_LINE_ALIGNMENT
extern Score pieceSquareTable[PIECE_NB][SQUARE_NB];
extern Value PieceValue[2][18]; // [Mg / Eg][piece / pieceType]
extern Value PieceValue[PHASE_NB][PIECE_NB];
extern int SquareDistance[SQUARE_NB][SQUARE_NB];
struct MoveStack {
@@ -392,7 +391,7 @@ inline PieceType type_of(Piece p) {
}
inline Color color_of(Piece p) {
return Color(p >> 3);
return p == NO_PIECE ? NO_COLOR : Color(p >> 3);
}
inline bool is_ok(Square s) {