Fix win simulation unnecessarily drawing same card

This commit is contained in:
ItsDrike 2024-12-07 12:02:55 +01:00
parent 0bee5ddc12
commit 1eb72163b5
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0

View file

@ -703,7 +703,9 @@ std::optional<bool> GameState::canWinThroughSimulation(QSet<QString>& visitedSta
}
// Simulate draw pile move
if (!(m_drawPile.isEmpty() && m_throwawayPile.isEmpty())) {
// (The condition also handles the case where there's only one card in the throwaway pile,
// which means drawing would just result in flipping and re-drawing the same card.)
if (!(m_drawPile.isEmpty() && m_throwawayPile.size() <= 1)) {
GameState* clonedState = this->clone();
assert(clonedState->drawNextCard());
assert(clonedState->generateStateHash() != generateStateHash());