Fix win simulation unnecessarily drawing same card
This commit is contained in:
parent
0bee5ddc12
commit
1eb72163b5
|
@ -703,7 +703,9 @@ std::optional<bool> GameState::canWinThroughSimulation(QSet<QString>& visitedSta
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simulate draw pile move
|
// 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();
|
GameState* clonedState = this->clone();
|
||||||
assert(clonedState->drawNextCard());
|
assert(clonedState->drawNextCard());
|
||||||
assert(clonedState->generateStateHash() != generateStateHash());
|
assert(clonedState->generateStateHash() != generateStateHash());
|
||||||
|
|
Loading…
Reference in a new issue