/*
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
/*
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
Stockfish is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Stockfish is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "types.h"
/// The checkInfo struct is initialized at c'tor time and keeps info used
/// to detect if a move gives check.
#include "types.h"
/// The checkInfo struct is initialized at c'tor time and keeps info used
/// to detect if a move gives check.
/// object to its previous state when we retract a move. Whenever a move
/// is made on the board (by calling Position::do_move), an StateInfo object
/// must be passed as a parameter.
/// object to its previous state when we retract a move. Whenever a move
/// is made on the board (by calling Position::do_move), an StateInfo object
/// must be passed as a parameter.
- Position(const Position& pos, int threadID);
- Position(const std::string& fen, bool isChess960, int threadID);
+ Position() {}
+ Position(const Position& pos, int th) { copy(pos, th); }
+ Position(const std::string& fen, bool isChess960, int th);
void from_fen(const std::string& fen, bool isChess960);
const std::string to_fen() const;
void print(Move m = MOVE_NONE) const;
// The piece on a given square
Piece piece_on(Square s) const;
void from_fen(const std::string& fen, bool isChess960);
const std::string to_fen() const;
void print(Move m = MOVE_NONE) const;
// The piece on a given square
Piece piece_on(Square s) const;
void do_move(Move m, StateInfo& st);
void do_move(Move m, StateInfo& st, const CheckInfo& ci, bool moveIsCheck);
void undo_move(Move m);
void do_move(Move m, StateInfo& st);
void do_move(Move m, StateInfo& st, const CheckInfo& ci, bool moveIsCheck);
void undo_move(Move m);
- Key get_key() const;
- Key get_exclusion_key() const;
- Key get_pawn_key() const;
- Key get_material_key() const;
+ Key key() const;
+ Key exclusion_key() const;
+ Key pawn_key() const;
+ Key material_key() const;
// Incremental evaluation
Score value() const;
Value non_pawn_material(Color c) const;
Score pst_delta(Piece piece, Square from, Square to) const;
// Incremental evaluation
Score value() const;
Value non_pawn_material(Color c) const;
Score pst_delta(Piece piece, Square from, Square to) const;
bool opposite_colored_bishops() const;
bool has_pawn_on_7th(Color c) const;
bool is_chess960() const;
bool opposite_colored_bishops() const;
bool has_pawn_on_7th(Color c) const;
bool is_chess960() const;
// Initialization helper functions (used while setting up a position)
void clear();
void put_piece(Piece p, Square s);
// Initialization helper functions (used while setting up a position)
void clear();
void put_piece(Piece p, Square s);
- // Helper functions for doing and undoing moves
- void do_capture_move(Key& key, PieceType capture, Color them, Square to, bool ep);
+ // Helper template functions
- return board[move_from(m)] == make_piece(sideToMove, PAWN)
- && pawn_is_passed(sideToMove, move_to(m));
+ return board[from_sq(m)] == make_piece(sideToMove, PAWN)
+ && pawn_is_passed(sideToMove, to_sq(m));
}
inline bool Position::is_capture(Move m) const {
// Note that castle is coded as "king captures the rook"
assert(is_ok(m));
}
inline bool Position::is_capture(Move m) const {
// Note that castle is coded as "king captures the rook"
assert(is_ok(m));