diff --git a/src/gamestate.cpp b/src/gamestate.cpp index ddb1d11..61f609c 100644 --- a/src/gamestate.cpp +++ b/src/gamestate.cpp @@ -453,32 +453,47 @@ QString GameState::generateStateHash() const { // The repetition here is annoying, I know for (const auto& column : m_columns) { for (const ColumnSlot* slot : column) { - stateHash += QString::number(slot->card()->value()) + QString::number(slot->card()->suit()); + stateHash += QString::number(slot->card()->value()) + "." + QString::number(slot->card()->suit()); stateHash += slot->isRevealed() ? "t" : "f"; stateHash += ","; } + stateHash.removeLast(); + stateHash += " "; } + stateHash.removeLast(); + stateHash += " ; "; + for (const auto& foundationPile : m_foundation) { for (const PlayingCard* card : foundationPile) { - stateHash += QString::number(card->value()) + QString::number(card->suit()) + ","; + stateHash += QString::number(card->value()) + "." + QString::number(card->suit()) + ","; } + stateHash.removeLast(); + stateHash += " "; } + stateHash.removeLast(); + stateHash += " ; "; + for (const PlayingCard* card : m_throwawayPile) { - stateHash += QString::number(card->value()) + QString::number(card->suit()) + ","; + stateHash += QString::number(card->value()) + "." + QString::number(card->suit()) + ","; } + stateHash.removeLast(); + stateHash += " ; "; + for (const PlayingCard* card : m_drawPile) { - stateHash += QString::number(card->value()) + QString::number(card->suit()) + ","; + stateHash += QString::number(card->value()) + "." + QString::number(card->suit()) + ","; } + stateHash.removeLast(); + stateHash += " ; "; + stateHash += m_gameWon ? "t" : "f"; return stateHash; } - bool GameState::tryAutoMoveSingleCard(PlayingCard& cardToMove, int skipColumnId) { // 1. Try moving the card to the foundation const int foundationId = static_cast(cardToMove.suit());