From 1eb72163b5ec0dfd2af3b90d39db5b70dc219ea0 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Sat, 7 Dec 2024 12:02:55 +0100 Subject: [PATCH] Fix win simulation unnecessarily drawing same card --- src/gamestate.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gamestate.cpp b/src/gamestate.cpp index 8f9293e..b2a5a2e 100644 --- a/src/gamestate.cpp +++ b/src/gamestate.cpp @@ -703,7 +703,9 @@ std::optional GameState::canWinThroughSimulation(QSet& 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());