rule: Modify the judgment condition of N-move rule from 'greater than' to 'greater than or equal to'
This commit is contained in:
parent
9b16a5955d
commit
6c78b9fbff
|
@ -1010,14 +1010,14 @@ bool Position::check_if_game_is_over()
|
|||
{
|
||||
#ifdef RULE_50
|
||||
if (rule.nMoveRule > 0 &&
|
||||
posKeyHistory.size() > rule.nMoveRule) {
|
||||
posKeyHistory.size() >= rule.nMoveRule) {
|
||||
set_gameover(DRAW, GameOverReason::drawReasonRule50);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (rule.endgameNMoveRule < rule.nMoveRule &&
|
||||
is_three_endgame() &&
|
||||
posKeyHistory.size() > rule.endgameNMoveRule) {
|
||||
posKeyHistory.size() >= rule.endgameNMoveRule) {
|
||||
set_gameover(DRAW, GameOverReason::drawReasonEndgameRule50);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -97,13 +97,13 @@ int Thread::search()
|
|||
|
||||
if (rootPos->get_phase() == Phase::moving) {
|
||||
#ifdef RULE_50
|
||||
if (posKeyHistory.size() > rule.nMoveRule) {
|
||||
if (posKeyHistory.size() >= rule.nMoveRule) {
|
||||
return 50;
|
||||
}
|
||||
|
||||
if (rule.endgameNMoveRule < rule.nMoveRule &&
|
||||
rootPos->is_three_endgame() &&
|
||||
posKeyHistory.size() > rule.endgameNMoveRule) {
|
||||
rootPos->is_three_endgame() &&
|
||||
posKeyHistory.size() >= rule.endgameNMoveRule) {
|
||||
return 10;
|
||||
}
|
||||
#endif // RULE_50
|
||||
|
@ -229,8 +229,8 @@ Value qsearch(Position *pos, Sanmill::Stack<Position> &ss, Depth depth, Depth or
|
|||
#ifdef RULE_50
|
||||
if ((pos->rule50_count() > rule.nMoveRule) ||
|
||||
(rule.endgameNMoveRule < rule.nMoveRule &&
|
||||
pos->is_three_endgame() &&
|
||||
pos->rule50_count() > rule.endgameNMoveRule)) {
|
||||
pos->is_three_endgame() &&
|
||||
pos->rule50_count() >= rule.endgameNMoveRule)) {
|
||||
alpha = VALUE_DRAW;
|
||||
if (alpha >= beta) {
|
||||
return alpha;
|
||||
|
|
|
@ -291,11 +291,11 @@ class Position {
|
|||
}
|
||||
|
||||
// TODO: WAR to judge rule50
|
||||
if (rule.nMoveRule > 0 && posKeyHistory.length > rule.nMoveRule - 1) {
|
||||
if (rule.nMoveRule > 0 && posKeyHistory.length >= rule.nMoveRule - 1) {
|
||||
gameOverReason = GameOverReason.drawReasonRule50;
|
||||
} else if (rule.endgameNMoveRule < rule.nMoveRule &&
|
||||
isThreeEndgame() &&
|
||||
posKeyHistory.length > rule.endgameNMoveRule - 1) {
|
||||
posKeyHistory.length >= rule.endgameNMoveRule - 1) {
|
||||
gameOverReason = GameOverReason.drawReasonEndgameRule50;
|
||||
} else {
|
||||
gameOverReason = GameOverReason.drawReasonThreefoldRepetition;
|
||||
|
@ -782,14 +782,14 @@ class Position {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (rule.nMoveRule > 0 && posKeyHistory.length > rule.nMoveRule) {
|
||||
if (rule.nMoveRule > 0 && posKeyHistory.length >= rule.nMoveRule) {
|
||||
setGameOver(PieceColor.draw, GameOverReason.drawReasonRule50);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (rule.endgameNMoveRule < rule.nMoveRule &&
|
||||
isThreeEndgame() &&
|
||||
posKeyHistory.length > rule.endgameNMoveRule) {
|
||||
posKeyHistory.length >= rule.endgameNMoveRule) {
|
||||
setGameOver(PieceColor.draw, GameOverReason.drawReasonEndgameRule50);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue