X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmove.cpp;h=da9e977dc611633e361db33e36467d46030777c4;hp=f915feecc1c5412974f25cf37de4d86f80d8918a;hb=853e2a9495afbe5789727c4c666c73c8276d8585;hpb=87ca13a79a8af25e9f335311008c257d101cbf12 diff --git a/src/move.cpp b/src/move.cpp index f915feec..da9e977d 100644 --- a/src/move.cpp +++ b/src/move.cpp @@ -66,11 +66,12 @@ const string move_to_uci(Move m, bool chess960) { /// move_from_uci() takes a position and a string representing a move in -/// simple coordinate notation and returns an equivalent Move. +/// simple coordinate notation and returns an equivalent Move if any. +/// Moves are guaranteed to be legal. Move move_from_uci(const Position& pos, const string& str) { - MoveStack mlist[MOVES_MAX]; + MoveStack mlist[MAX_MOVES]; MoveStack* last = generate(pos, mlist); for (MoveStack* cur = mlist; cur != last; cur++) @@ -90,7 +91,7 @@ const string move_to_san(Position& pos, Move m) { assert(pos.is_ok()); assert(move_is_ok(m)); - MoveStack mlist[MOVES_MAX]; + MoveStack mlist[MAX_MOVES]; Square from = move_from(m); Square to = move_to(m); PieceType pt = pos.type_of_piece_on(from); @@ -155,11 +156,11 @@ const string move_to_san(Position& pos, Move m) { } } - // The move gives check? We don't use pos.move_is_check() here + // The move gives check? We don't use pos.move_gives_check() here // because we need to test for a mate after the move is done. StateInfo st; pos.do_move(m, st); - if (pos.is_check()) + if (pos.in_check()) san += pos.is_mate() ? "#" : "+"; pos.undo_move(m);