#ifndef GAMESTATE_H #define GAMESTATE_H #include #include "playingcard.h" #include "columnslot.h" class GameState : public QObject { Q_OBJECT Q_PROPERTY(QList drawPile READ drawPile NOTIFY onDrawPileChanged) Q_PROPERTY(QList throwawayPile READ throwawayPile NOTIFY onThrowawayPileChanged) Q_PROPERTY(QList> columns READ columns NOTIFY onColumnsChanged) Q_PROPERTY(QList> foundation READ foundation NOTIFY onFoundationChanged) public: explicit GameState(QObject *parent = nullptr); QList drawPile() const; QList throwawayPile() const; QList> columns() const; QList> foundation() const; void dealCards(); void drawNextCard(); bool moveCardToColumn(int columnId); bool moveThrownCardToFoundation(PlayingCard::Suit foundationId); bool moveColumnCardToFoundation(int columnId, PlayingCard::Suit foundationId); signals: void onDrawPileChanged(); void onThrowawayPileChanged(); void onColumnsChanged(); void onFoundationChanged(); private: QList m_drawPile; QList m_throwawayPile; QList> m_columns; QList> m_foundation; bool tryMoveCardToFoundation(PlayingCard::Suit foundationId, PlayingCard* cardToMove); void ensureColumnRevealed(int columnId); }; #endif // GAMESTATE_H