rule50: Count rule50 only when continuous MOVETYPE_MOVE

Note: UCI is not tested.
This commit is contained in:
Calcitem 2021-01-12 01:46:19 +08:00
parent 285cee07ef
commit 1ae4d49fa6
3 changed files with 18 additions and 2 deletions

View File

@ -103,7 +103,7 @@ int Thread::search()
#endif // THREEFOLD_REPETITION
#if defined(UCI_DO_BEST_MOVE) || defined(QT_GUI_LIB)
posKeyHistory.push_back(rootPos->key());
//posKeyHistory.push_back(rootPos->key());
#endif // UCI_DO_BEST_MOVE
assert(posKeyHistory.size() < 256);

View File

@ -77,7 +77,11 @@ void position(Position *pos, istringstream &is)
// Parse move list (if any)
while (is >> token && (m = UCI::to_move(pos, token)) != MOVE_NONE) {
pos->do_move(m);
posKeyHistory.push_back(pos->key());
if (type_of(m) == MOVETYPE_MOVE) {
posKeyHistory.push_back(pos->key());
} else {
posKeyHistory.clear();
}
}
// TODO: Stockfish does not have this

View File

@ -852,6 +852,12 @@ bool Game::actionPiece(QPointF p)
if (result) {
moveHistory.emplace_back(position.record);
if (strlen(position.record) > strlen("-(1,2)")) {
posKeyHistory.push_back(position.key());
} else {
posKeyHistory.clear();
}
// Signal update status bar
updateScence();
message = QString::fromStdString(getTips());
@ -963,6 +969,12 @@ bool Game::command(const string &cmd, bool update /* = true */)
moveHistory.emplace_back(cmd);
if (cmd.size() > strlen("-(1,2)")) {
posKeyHistory.push_back(position.key());
} else {
posKeyHistory.clear();
}
if (!position.command(cmd.c_str()))
return false;