remove_piece: 将少于2子的判断重新移动到 board 变更之后

以解决 962cece2c5 引入的最终棋盘上
还没到去掉倒数第3子就结束对局的问题。
This commit is contained in:
Calcitem 2020-09-20 20:58:23 +08:00
parent 7b5e1a2f2b
commit 346fa2dfb9
1 changed files with 9 additions and 11 deletions

View File

@ -755,15 +755,6 @@ bool Position::remove_piece(Square s, bool updateCmdlist)
return false;
}
pieceCountOnBoard[them]--;
if (pieceCountOnBoard[them] + pieceCountInHand[them] < rule.nPiecesAtLeast) {
winner = sideToMove;
phase = PHASE_GAMEOVER;
gameoverReason = LOSE_REASON_LESS_THAN_THREE;
return true;
}
revert_key(s);
if (rule.hasBannedLocations && phase == PHASE_PLACING) {
@ -783,12 +774,19 @@ bool Position::remove_piece(Square s, bool updateCmdlist)
st->rule50 = 0; // TODO: Need to move out?
}
pieceCountOnBoard[them]--;
if (pieceCountOnBoard[them] + pieceCountInHand[them] < rule.nPiecesAtLeast) {
winner = sideToMove;
phase = PHASE_GAMEOVER;
gameoverReason = LOSE_REASON_LESS_THAN_THREE;
return true;
}
currentSquare = SQ_0;
pieceCountNeedRemove--;
// Remove piece completed
if (pieceCountNeedRemove > 0) {
return true;
}