X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fuci.cpp;h=813c40f7db08a1774363a07a66564e20a14aee66;hp=931891a0263cc6c32f7df193a8380a487e9aa905;hb=5f7eb20090ccd04b2a7d439b723ed58591dcc7e8;hpb=03ad183384d484990248cb22394a93926f421520 diff --git a/src/uci.cpp b/src/uci.cpp index 931891a0..813c40f7 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -38,8 +38,9 @@ namespace { const string StartPositionFEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; // Keep track of position keys along the setup moves (from start position to the - // position just before to start searching). This is needed by draw detection. - std::vector SetupState(200, StateInfo()); + // position just before to start searching). This is needed by draw detection + // where, due to 50 moves rule, we need to ckeck at most 100 plies back. + StateInfo StateRingBuf[102], *SetupState = StateRingBuf; // UCIParser is a class for parsing UCI input. The class // is actually a string stream built on a given input string. @@ -144,13 +145,14 @@ namespace { } else return; - SetupState.clear(); - // Parse move list (if any) while (up >> token && (m = move_from_uci(pos, token)) != MOVE_NONE) { - SetupState.push_back(StateInfo()); - pos.do_move(m, SetupState.back()); + pos.do_move(m, *SetupState); + + // Increment pointer to StateRingBuf circular buffer + if (++SetupState - StateRingBuf >= 102) + SetupState = StateRingBuf; } }