+++ /dev/null
-/*
- 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)
#if !defined(EVALUATE_H_INCLUDED)
#define EVALUATE_H_INCLUDED
-#include "color.h"
+#include "piece.h"
#include "value.h"
class Position;
#if !defined(PIECE_H_INCLUDED)
#define PIECE_H_INCLUDED
-#include "color.h"
#include "value.h"
enum PieceType {
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
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;
}
#define POSITION_H_INCLUDED
#include "bitboard.h"
-#include "color.h"
#include "move.h"
#include "piece.h"
#include "square.h"
#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,
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));
}
}
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) {