Add RULE_50 macro

This commit is contained in:
Calcitem 2021-01-14 01:29:25 +08:00
parent b61683f657
commit 00547b79e6
3 changed files with 8 additions and 0 deletions

View File

@ -97,6 +97,7 @@
//#define ENDGAME_LEARNING_FORCE
#define THREEFOLD_REPETITION
#define RULE_50
//#define MESSAGEBOX_ENABLE

View File

@ -941,6 +941,7 @@ bool Position::check_if_game_is_over()
return true;
}
#ifdef RULE_50
if (rule.maxStepsLedToDraw > 0 &&
posKeyHistory.size() > rule.maxStepsLedToDraw) {
winner = DRAW;
@ -948,6 +949,7 @@ bool Position::check_if_game_is_over()
gameOverReason = GameOverReason::drawReasonRule50;
return true;
}
#endif // RULE_50
if (pieceOnBoardCount[BLACK] + pieceOnBoardCount[WHITE] >= EFFECTIVE_SQUARE_NB) {
if (rule.isBlackLoseButNotDrawWhenBoardFull) {

View File

@ -93,9 +93,12 @@ int Thread::search()
#endif
if (rootPos->get_phase() == Phase::moving) {
#ifdef RULE_50
if (posKeyHistory.size() > rule.maxStepsLedToDraw) {
return 99;
}
#endif // RULE_50
#ifdef THREEFOLD_REPETITION
if (rootPos->has_game_cycle()) {
return 3;
@ -204,12 +207,14 @@ Value search(Position *pos, Sanmill::Stack<Position> &ss, Depth depth, Depth ori
Depth epsilon;
#ifdef RULE_50
if (pos->rule50_count() > 99) {
alpha = VALUE_DRAW;
if (alpha >= beta) {
return alpha;
}
}
#endif // RULE_50
#ifdef THREEFOLD_REPETITION_TEST
// Check if we have an upcoming move which draws by repetition, or