Improve preliminary win check
This commit is contained in:
parent
d68b2ecbcb
commit
5a2e7d5465
|
@ -633,22 +633,22 @@ void GameState::incrementMoveAmt() {
|
||||||
|
|
||||||
bool GameState::prelimWinCheck() {
|
bool GameState::prelimWinCheck() {
|
||||||
// Check if the game is preliminarily won:
|
// Check if the game is preliminarily won:
|
||||||
// This occurs when there are no cards in the draw or throwaway piles,
|
// This occurs when all cards in the tableau are revealed.
|
||||||
// and all cards in the tableau are revealed. Such games are essentially won,
|
// Games in this state are essentially won, as the cards
|
||||||
// as the cards only need to be moved to the foundation piles.
|
// only need to be moved to the foundation piles.
|
||||||
bool prelimWin = m_drawPile.isEmpty() && m_throwawayPile.isEmpty();
|
|
||||||
|
|
||||||
if (prelimWin) {
|
bool prelimWin = true; // Assume a preliminary win unless proven otherwise.
|
||||||
for (const auto& column : std::as_const(m_columns)) {
|
|
||||||
for (const ColumnSlot* card : column) {
|
// Check if all tableau cards are revealed
|
||||||
if (!card->isRevealed()) {
|
for (const auto& column : std::as_const(m_columns)) {
|
||||||
prelimWin = false;
|
for (const ColumnSlot* card : column) {
|
||||||
break;
|
if (!card->isRevealed()) {
|
||||||
}
|
prelimWin = false;
|
||||||
}
|
|
||||||
if (!prelimWin)
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (!prelimWin)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prelimWin == m_prelimWin)
|
if (prelimWin == m_prelimWin)
|
||||||
|
|
Loading…
Reference in a new issue