diff --git a/src/color.h b/src/color.h
deleted file mode 100644
index 08eb8d81..00000000
--- a/src/color.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- Stockfish, a UCI chess playing engine derived from Glaurung 2.1
- Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
- Copyright (C) 2008-2010 Marco Costalba, Joona Kiiski, Tord Romstad
-
- Stockfish is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- Stockfish is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-*/
-
-
-#if !defined(COLOR_H_INCLUDED)
-#define COLOR_H_INCLUDED
-
-#include "types.h"
-
-////
-//// Types
-////
-
-enum Color {
- WHITE,
- BLACK,
- COLOR_NONE
-};
-
-enum SquareColor {
- DARK,
- LIGHT
-};
-
-ENABLE_OPERATORS_ON(Color)
-
-
-////
-//// Inline functions
-////
-
-inline Color opposite_color(Color c) {
- return Color(int(c) ^ 1);
-}
-
-inline bool color_is_ok(Color c) {
- return c == WHITE || c == BLACK;
-}
-
-#endif // !defined(COLOR_H_INCLUDED)
diff --git a/src/evaluate.h b/src/evaluate.h
index 6651aca2..a3347022 100644
--- a/src/evaluate.h
+++ b/src/evaluate.h
@@ -21,7 +21,7 @@
#if !defined(EVALUATE_H_INCLUDED)
#define EVALUATE_H_INCLUDED
-#include "color.h"
+#include "piece.h"
#include "value.h"
class Position;
diff --git a/src/piece.h b/src/piece.h
index 12983a6b..341e877d 100644
--- a/src/piece.h
+++ b/src/piece.h
@@ -20,7 +20,6 @@
#if !defined(PIECE_H_INCLUDED)
#define PIECE_H_INCLUDED
-#include "color.h"
#include "value.h"
enum PieceType {
@@ -33,8 +32,13 @@ enum Piece {
BP = 9, BN = 10, BB = 11, BR = 12, BQ = 13, BK = 14, PIECE_NONE = 16
};
+enum Color {
+ WHITE, BLACK, COLOR_NONE
+};
+
ENABLE_OPERATORS_ON(PieceType)
ENABLE_OPERATORS_ON(Piece)
+ENABLE_OPERATORS_ON(Color)
/// Important: If the material values are changed, one must also
/// adjust the piece square tables, and the method game_phase() in the
@@ -65,6 +69,14 @@ inline Color color_of_piece(Piece p) {
return Color(int(p) >> 3);
}
+inline Color opposite_color(Color c) {
+ return Color(int(c) ^ 1);
+}
+
+inline bool color_is_ok(Color c) {
+ return c == WHITE || c == BLACK;
+}
+
inline bool piece_type_is_ok(PieceType pt) {
return pt >= PAWN && pt <= KING;
}
diff --git a/src/position.h b/src/position.h
index e76844f6..91604e94 100644
--- a/src/position.h
+++ b/src/position.h
@@ -21,7 +21,6 @@
#define POSITION_H_INCLUDED
#include "bitboard.h"
-#include "color.h"
#include "move.h"
#include "piece.h"
#include "square.h"
diff --git a/src/square.h b/src/square.h
index bc5221b6..05be4bed 100644
--- a/src/square.h
+++ b/src/square.h
@@ -23,8 +23,8 @@
#include // for abs()
#include
-#include "color.h"
#include "misc.h"
+#include "piece.h"
enum Square {
SQ_A1, SQ_B1, SQ_C1, SQ_D1, SQ_E1, SQ_F1, SQ_G1, SQ_H1,
@@ -58,13 +58,14 @@ enum Rank {
RANK_1, RANK_2, RANK_3, RANK_4, RANK_5, RANK_6, RANK_7, RANK_8
};
+enum SquareColor {
+ DARK, LIGHT
+};
+
ENABLE_OPERATORS_ON(Square)
ENABLE_OPERATORS_ON(File)
ENABLE_OPERATORS_ON(Rank)
-const int FlipMask = 56;
-const int FlopMask = 7;
-
inline Square make_square(File f, Rank r) {
return Square((int(r) << 3) | int(f));
}
@@ -78,15 +79,15 @@ inline Rank square_rank(Square s) {
}
inline Square flip_square(Square s) {
- return Square(int(s) ^ FlipMask);
+ return Square(int(s) ^ 56);
}
inline Square flop_square(Square s) {
- return Square(int(s) ^ FlopMask);
+ return Square(int(s) ^ 7);
}
inline Square relative_square(Color c, Square s) {
- return Square(int(s) ^ (int(c) * FlipMask));
+ return Square(int(s) ^ (int(c) * 56));
}
inline Rank relative_rank(Color c, Rank r) {