//// Variables
////
+extern SearchStack EmptySearchStack;
+
int Position::castleRightsMask[64];
Key Position::zobrist[2][8][64];
Value Position::MgPieceSquareTable[16][64];
Value Position::EgPieceSquareTable[16][64];
+static bool RequestPending = false;
////
//// Functions
static const std::string pieceLetters = " PNBRQK PNBRQK .";
+ // Check for reentrancy, as example when called from inside
+ // MovePicker that is used also here in move_to_san()
+ if (RequestPending)
+ return;
+
+ RequestPending = true;
+
std::cout << std::endl;
if (m != MOVE_NONE)
{
- Position p(*this);
std::string col = (color_of_piece_on(move_from(m)) == BLACK ? ".." : "");
- std::cout << "Move is: " << col << move_to_san(p, m) << std::endl;
+ std::cout << "Move is: " << col << move_to_san(*this, m) << std::endl;
}
for (Rank rank = RANK_8; rank >= RANK_1; rank--)
{
std::cout << "+---+---+---+---+---+---+---+---+" << std::endl
<< "Fen is: " << to_fen() << std::endl
<< "Key is: " << key << std::endl;
+
+ RequestPending = false;
}
/// Position::move_is_capture() tests whether a move from the current
-/// position is a capture.
+/// position is a capture. Move must not be MOVE_NONE.
bool Position::move_is_capture(Move m) const {
+ assert(m != MOVE_NONE);
+
return ( !square_is_empty(move_to(m))
&& (color_of_piece_on(move_to(m)) == opposite_color(side_to_move()))
)