#define POSITION_H_INCLUDED
#include "bitboard.h"
-#include "color.h"
#include "move.h"
-#include "piece.h"
-#include "square.h"
-#include "value.h"
+#include "types.h"
/// Maximum number of plies per game (220 should be enough, because the
/// maximum search depth is 100, and during position setup we reset the
class Position {
- friend class MaterialInfo;
- friend class EndgameFunctions;
-
Position(); // No default or copy c'tor allowed
Position(const Position& pos);
bool is_mate() const;
bool is_draw() const;
- // Check if side to move could be mated in one
- bool has_mate_threat();
-
// Number of plies from starting position
int startpos_ply_counter() const;
int castleRightsMask[64];
StateInfo startState;
File initialKFile, initialKRFile, initialQRFile;
- bool isChess960;
+ bool chess960;
int startPosPlyCounter;
int threadID;
int64_t nodes;
template<>
inline Bitboard Position::attacks_from<PAWN>(Square s, Color c) const {
- return NonSlidingAttacksBB[piece_of_color_and_type(c, PAWN)][s];
+ return StepAttacksBB[make_piece(c, PAWN)][s];
}
template<PieceType Piece> // Knight and King and white pawns
inline Bitboard Position::attacks_from(Square s) const {
- return NonSlidingAttacksBB[Piece][s];
+ return StepAttacksBB[Piece][s];
}
template<>
}
inline Score Position::pst(Color c, PieceType pt, Square s) {
- return PieceSquareTable[piece_of_color_and_type(c, pt)][s];
+ return PieceSquareTable[make_piece(c, pt)][s];
}
inline Score Position::pst_delta(Piece piece, Square from, Square to) {
inline bool Position::move_is_passed_pawn_push(Move m) const {
Color c = side_to_move();
- return piece_on(move_from(m)) == piece_of_color_and_type(c, PAWN)
+ return piece_on(move_from(m)) == make_piece(c, PAWN)
&& pawn_is_passed(c, move_to(m));
}
}
inline bool Position::is_chess960() const {
- return isChess960;
+ return chess960;
}
inline bool Position::move_is_capture(Move m) const {