]> git.sesse.net Git - stockfish/commit
Use a circular buffer to keep track of setup states
authorMarco Costalba <mcostalba@gmail.com>
Sat, 23 Jul 2011 11:52:49 +0000 (12:52 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 24 Jul 2011 05:15:40 +0000 (06:15 +0100)
commit5f7eb20090ccd04b2a7d439b723ed58591dcc7e8
tree4f6f5fa19c3c093cbcd58bf22d33172abd759134
parent03ad183384d484990248cb22394a93926f421520
Use a circular buffer to keep track of setup states

This fixes a regression on real games due to the fact that
we have some mismatches:

    history[st->gamePly - i] != stp->key

when st->gamePly - i == 0,this is due to a nasty bug I have
introduced when using std::vector<> as StateInfo backup. The
point is that StateInfo keeps inside a pointer to the previous
StateInfo in a kind of linked list. But when std::vector<> is
resized reallocates a larger chunk of memory and moves the
data there so these pointers became stale.

This patch fixes the issue.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/uci.cpp