mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 08:36:33 +08:00
Change move_is_ok() and square_is_ok() in something useful
As is defined now is always true, tested with:
for (long i=-1000000; i < 1000000; i++)
if (!move_is_ok(Move(i)))
exit(0);
Reason is that move_from() and move_to() already truncate the
input value to something in the range [0, 63] that is always
a possible square.
So change definition to something useful.
The same applies also to square_is_ok()
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -135,7 +135,7 @@ const std::string move_to_uci(Move move, bool chess960) {
|
||||
}
|
||||
|
||||
|
||||
/// Overload the << operator, to make it easier to print moves.
|
||||
/// Overload the << operator, to make it easier to print moves
|
||||
|
||||
std::ostream& operator << (std::ostream& os, Move m) {
|
||||
|
||||
@@ -144,9 +144,9 @@ std::ostream& operator << (std::ostream& os, Move m) {
|
||||
}
|
||||
|
||||
|
||||
/// move_is_ok(), for debugging.
|
||||
/// move_is_ok(), for debugging
|
||||
|
||||
bool move_is_ok(Move m) {
|
||||
|
||||
return square_is_ok(move_from(m)) && square_is_ok(move_to(m));
|
||||
return move_from(m) != move_to(m); // Catches also MOVE_NONE
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user