mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 08:36:33 +08:00
Introduce StateInfo instead of UndoInfo
We don't backup anymore but use the renamed StateInfo argument passed in do_move() to store the new position state when doing a move. Backup is now just revert to previous StateInfo that we know because we store a pointer to it. Note that now backing store is up to the caller, Position is stateless in that regard, state is accessed through a pointer. This patch will let us remove all the backup/restore copying, just a pointer switch is now necessary. Note that do_null_move() still uses StateInfo as backup. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -177,13 +177,13 @@ void TranspositionTable::new_search() {
|
||||
|
||||
void TranspositionTable::insert_pv(const Position &pos, Move pv[]) {
|
||||
|
||||
UndoInfo u;
|
||||
StateInfo st;
|
||||
Position p(pos);
|
||||
|
||||
for (int i = 0; pv[i] != MOVE_NONE; i++)
|
||||
{
|
||||
store(p, VALUE_NONE, Depth(0), pv[i], VALUE_TYPE_NONE);
|
||||
p.do_move(pv[i], u);
|
||||
p.do_move(pv[i], st);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user