Skip to content

Commit

Permalink
Check if game is over when parsing fen to position
Browse files Browse the repository at this point in the history
It can solve the problem that after tapping Move Now after this kind of FEN import,
AI can't do 2 move in a row. (when specific settings are turned on)
**@@@@**/**@oO@**/**@oO@** w m s 4 0 8 0 1 0 0 1
**@@@@**/**@oO@**/**@oO@** w m s 4 0 8 0 0 0 0 1

But it still can't be solved for the following FEN.
**@@@@**/**@oO@**/**@oO@** w m r 4 0 8 0 1 0 0 1

Change-Id: Id30a2ca6e81de687a882f1b9aaaf5c596cd243f3
  • Loading branch information
calcitem committed Jan 30, 2023
1 parent 78674b9 commit b3a7639
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/position.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,16 @@ Position &Position::set(const string &fenStr, Thread *th)
// handle also common incorrect FEN with fullmove = 0.
gamePly = std::max(2 * (gamePly - 1), 0) + (sideToMove == BLACK);

// For Mill only
check_if_game_is_over();
#if 0
// It doesn't work
if (pieceToRemoveCount[sideToMove] == 1) {
action = Action::remove;
isStalemateRemoving = true;
}
#endif

thisThread = th;

return *this;
Expand Down

0 comments on commit b3a7639

Please sign in to comment.