将 check_gameover_condition() 中对于对方是否总子数少于3的判断转移到 remove_piece() 中

This commit is contained in:
Calcitem 2020-09-20 16:59:14 +08:00
parent 6173894f20
commit c4be5d3da9
1 changed files with 4 additions and 11 deletions

View File

@ -764,7 +764,10 @@ bool Position::remove_piece(Square s, bool updateCmdlist)
pieceCountOnBoard[them]--; pieceCountOnBoard[them]--;
if (check_gameover_condition()) { if (pieceCountOnBoard[them] + pieceCountInHand[them] < rule.nPiecesAtLeast) {
winner = sideToMove;
phase = PHASE_GAMEOVER;
gameoverReason = LOSE_REASON_LESS_THAN_THREE;
goto out; goto out;
} }
@ -975,16 +978,6 @@ bool Position::check_gameover_condition()
return true; return true;
} }
for (int i = 1; i <= 2; i++)
{
if (pieceCountOnBoard[i] + pieceCountInHand[i] < rule.nPiecesAtLeast) {
winner = ~Color(i);
phase = PHASE_GAMEOVER;
gameoverReason = LOSE_REASON_LESS_THAN_THREE;
return true;
}
}
#ifdef MCTS_AI #ifdef MCTS_AI
#if 0 #if 0
int diff = pieceCountOnBoard[BLACK] - pieceCountOnBoard[WHITE]; int diff = pieceCountOnBoard[BLACK] - pieceCountOnBoard[WHITE];