mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-17 23:56:23 +08:00
Convert also undo_null_move() to avoid passing UndoInfo object
No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -1445,10 +1445,12 @@ void Position::do_null_move(UndoInfo& u) {
|
|||||||
assert(!is_check());
|
assert(!is_check());
|
||||||
|
|
||||||
// Back up the information necessary to undo the null move to the supplied
|
// Back up the information necessary to undo the null move to the supplied
|
||||||
// UndoInfo object. In the case of a null move, the only thing we need to
|
// UndoInfo object. In the case of a null move, the only thing we need to
|
||||||
// remember is the last move made and the en passant square.
|
// remember is the last move made and the en passant square.
|
||||||
u.lastMove = lastMove;
|
u.lastMove = lastMove;
|
||||||
u.epSquare = epSquare;
|
u.epSquare = epSquare;
|
||||||
|
u.previous = previous;
|
||||||
|
previous = &u;
|
||||||
|
|
||||||
// Save the current key to the history[] array, in order to be able to
|
// Save the current key to the history[] array, in order to be able to
|
||||||
// detect repetition draws.
|
// detect repetition draws.
|
||||||
@@ -1473,18 +1475,20 @@ void Position::do_null_move(UndoInfo& u) {
|
|||||||
|
|
||||||
/// Position::undo_null_move() unmakes a "null move".
|
/// Position::undo_null_move() unmakes a "null move".
|
||||||
|
|
||||||
void Position::undo_null_move(const UndoInfo &u) {
|
void Position::undo_null_move() {
|
||||||
|
|
||||||
assert(is_ok());
|
assert(is_ok());
|
||||||
assert(!is_check());
|
assert(!is_check());
|
||||||
|
|
||||||
// Restore information from the supplied UndoInfo object:
|
// Restore information from the our UndoInfo object
|
||||||
lastMove = u.lastMove;
|
lastMove = previous->lastMove;
|
||||||
epSquare = u.epSquare;
|
epSquare = previous->epSquare;
|
||||||
|
previous = previous->previous;
|
||||||
|
|
||||||
if (epSquare != SQ_NONE)
|
if (epSquare != SQ_NONE)
|
||||||
key ^= zobEp[epSquare];
|
key ^= zobEp[epSquare];
|
||||||
|
|
||||||
// Update the necessary information.
|
// Update the necessary information
|
||||||
sideToMove = opposite_color(sideToMove);
|
sideToMove = opposite_color(sideToMove);
|
||||||
rule50--;
|
rule50--;
|
||||||
gamePly--;
|
gamePly--;
|
||||||
@@ -1942,7 +1946,7 @@ bool Position::has_mate_threat(Color c) {
|
|||||||
|
|
||||||
// Undo null move, if necessary
|
// Undo null move, if necessary
|
||||||
if (c != stm)
|
if (c != stm)
|
||||||
undo_null_move(u1);
|
undo_null_move();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ public:
|
|||||||
void do_move(Move m, UndoInfo &u);
|
void do_move(Move m, UndoInfo &u);
|
||||||
void undo_move(Move m);
|
void undo_move(Move m);
|
||||||
void do_null_move(UndoInfo &u);
|
void do_null_move(UndoInfo &u);
|
||||||
void undo_null_move(const UndoInfo &u);
|
void undo_null_move();
|
||||||
|
|
||||||
// Static exchange evaluation
|
// Static exchange evaluation
|
||||||
int see(Square from, Square to) const;
|
int see(Square from, Square to) const;
|
||||||
|
|||||||
@@ -1201,7 +1201,7 @@ namespace {
|
|||||||
&& pos.see(ss[ply + 1].currentMove) + nullValue >= beta)
|
&& pos.see(ss[ply + 1].currentMove) + nullValue >= beta)
|
||||||
nullDrivenIID = true;
|
nullDrivenIID = true;
|
||||||
|
|
||||||
pos.undo_null_move(u);
|
pos.undo_null_move();
|
||||||
|
|
||||||
if (value_is_mate(nullValue))
|
if (value_is_mate(nullValue))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user