mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-23 02:27:00 +08:00
Fix null move issue
Fix altering for stats landing on B1 Square after a null move and fix considering counter-moves on A1 for root node. fixes https://github.com/official-stockfish/Stockfish/issues/4333 by preventing calls to from_sq and to_sq functions over null-moves and none-moves. closes https://github.com/official-stockfish/Stockfish/pull/4448 bench: 4980082
This commit is contained in:
committed by
Joost VandeVondele
parent
f0556dcbe3
commit
515b66f188
10
src/types.h
10
src/types.h
@@ -416,6 +416,10 @@ inline Color color_of(Piece pc) {
|
||||
return Color(pc >> 3);
|
||||
}
|
||||
|
||||
constexpr bool is_ok(Move m) {
|
||||
return m != MOVE_NONE && m != MOVE_NULL;
|
||||
}
|
||||
|
||||
constexpr bool is_ok(Square s) {
|
||||
return s >= SQ_A1 && s <= SQ_H8;
|
||||
}
|
||||
@@ -445,10 +449,12 @@ constexpr Direction pawn_push(Color c) {
|
||||
}
|
||||
|
||||
constexpr Square from_sq(Move m) {
|
||||
assert(is_ok(m));
|
||||
return Square((m >> 6) & 0x3F);
|
||||
}
|
||||
|
||||
constexpr Square to_sq(Move m) {
|
||||
assert(is_ok(m));
|
||||
return Square(m & 0x3F);
|
||||
}
|
||||
|
||||
@@ -473,10 +479,6 @@ constexpr Move make(Square from, Square to, PieceType pt = KNIGHT) {
|
||||
return Move(T + ((pt - KNIGHT) << 12) + (from << 6) + to);
|
||||
}
|
||||
|
||||
constexpr bool is_ok(Move m) {
|
||||
return from_sq(m) != to_sq(m); // Catch MOVE_NULL and MOVE_NONE
|
||||
}
|
||||
|
||||
/// Based on a congruential pseudo random number generator
|
||||
constexpr Key make_key(uint64_t seed) {
|
||||
return seed * 6364136223846793005ULL + 1442695040888963407ULL;
|
||||
|
||||
Reference in New Issue
Block a user