X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmove.cpp;h=8cc0c004dac94bd27171ddefab6ce77d0baedce2;hp=247f8a2abe218a3af10339bb095e84ffe97ff60a;hb=03ad183384d484990248cb22394a93926f421520;hpb=95d9687d95e5aa540c58e673300ef911164c90e0 diff --git a/src/move.cpp b/src/move.cpp index 247f8a2a..8cc0c004 100644 --- a/src/move.cpp +++ b/src/move.cpp @@ -25,7 +25,7 @@ #include "move.h" #include "movegen.h" -#include "search.h" +#include "position.h" using std::string; @@ -77,12 +77,17 @@ Move move_from_uci(const Position& pos, const string& str) { /// move_to_san() takes a position and a move as input, where it is assumed -/// that the move is a legal move from the position. The return value is +/// that the move is a legal move for the position. The return value is /// a string containing the move in short algebraic notation. const string move_to_san(Position& pos, Move m) { - assert(pos.is_ok()); + if (m == MOVE_NONE) + return "(none)"; + + if (m == MOVE_NULL) + return "(null)"; + assert(move_is_ok(m)); Bitboard attackers; @@ -92,12 +97,6 @@ const string move_to_san(Position& pos, Move m) { PieceType pt = piece_type(pos.piece_on(from)); string san; - if (m == MOVE_NONE) - return "(none)"; - - if (m == MOVE_NULL) - return "(null)"; - if (move_is_castle(m)) san = (move_to(m) < move_from(m) ? "O-O-O" : "O-O"); else