flutter: game: doMove: Do not add to moveHistory if position.doMove return false

This commit is contained in:
Calcitem 2021-04-16 23:37:00 +08:00
parent f0f28d9d4f
commit 0b6d58da36
1 changed files with 2 additions and 2 deletions

View File

@ -120,12 +120,12 @@ class Game {
print("Computer: $move");
moveHistory.add(move);
if (!position.doMove(move)) {
return false;
}
moveHistory.add(move);
sideToMove = position.sideToMove() ?? PieceColor.nobody;
printStat();