]> git.sesse.net Git - stockfish/commitdiff
Retire color.h
authorMarco Costalba <mcostalba@gmail.com>
Wed, 23 Feb 2011 13:34:00 +0000 (14:34 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 23 Feb 2011 17:42:45 +0000 (18:42 +0100)
Move contents to piece.h and square.h

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/color.h [deleted file]
src/evaluate.h
src/piece.h
src/position.h
src/square.h

diff --git a/src/color.h b/src/color.h
deleted file mode 100644 (file)
index 08eb8d8..0000000
+++ /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 <http://www.gnu.org/licenses/>.
-*/
-
-
-#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)
index 6651aca2cc3d7d724f8cdba210c5cfbcda314891..a33470221cf93091df0c2e19cec379531a198e1f 100644 (file)
@@ -21,7 +21,7 @@
 #if !defined(EVALUATE_H_INCLUDED)
 #define EVALUATE_H_INCLUDED
 
-#include "color.h"
+#include "piece.h"
 #include "value.h"
 
 class Position;
index 12983a6bb92a996b7fc6df6ff4ba5da780170d78..341e877dab938863708cc6216676d0766e933fef 100644 (file)
@@ -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;
 }
index e76844f6b1c07ffb9b244f1f446732566360b4e4..91604e94a81d12f1068c3db6b7a62e54f30fd8f3 100644 (file)
@@ -21,7 +21,6 @@
 #define POSITION_H_INCLUDED
 
 #include "bitboard.h"
-#include "color.h"
 #include "move.h"
 #include "piece.h"
 #include "square.h"
index bc5221b6b74578d2030042a4a3ddd6e69adda001..05be4bed7cf30a8be4c58d9094d91def9a49289b 100644 (file)
@@ -23,8 +23,8 @@
 #include <cstdlib> // for abs()
 #include <string>
 
-#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) {