#include <cstring>
#include <string>
-#include "move.h"
#include "movegen.h"
#include "position.h"
if (m == MOVE_NULL)
return "0000";
- if (move_is_castle(m) && !chess960)
+ if (is_castle(m) && !chess960)
to = from + (file_of(to) == FILE_H ? Square(2) : -Square(2));
- if (move_is_promotion(m))
+ if (is_promotion(m))
promotion = char(tolower(piece_type_to_char(promotion_piece_type(m))));
return square_to_string(from) + square_to_string(to) + promotion;
if (m == MOVE_NULL)
return "(null)";
- assert(move_is_ok(m));
+ assert(is_ok(m));
Bitboard attackers;
bool ambiguousMove, ambiguousFile, ambiguousRank;
PieceType pt = type_of(pos.piece_on(from));
string san;
- if (move_is_castle(m))
+ if (is_castle(m))
san = (move_to(m) < move_from(m) ? "O-O-O" : "O-O");
else
{
{
sq = pop_1st_bit(&attackers);
+ // Pinned pieces are not included in the possible sub-set
+ if (!pos.pl_move_is_legal(make_move(sq, to), pos.pinned_pieces()))
+ continue;
+
if (file_of(sq) == file_of(from))
ambiguousFile = true;
}
}
- if (pos.move_is_capture(m))
+ if (pos.is_capture(m))
{
if (pt == PAWN)
san += file_to_char(file_of(from));
san += square_to_string(to);
- if (move_is_promotion(m))
+ if (is_promotion(m))
{
san += '=';
san += piece_type_to_char(promotion_piece_type(m));