4#include <phosphorus/GameObject.h>
6#include "CardConstants.h"
21 Phosphorus::Int8Parameter m_BaseStackSize;
24 explicit CardStack(int32 baseStackSize);
25 ~CardStack()
override =
default;
30 void Insert(
const uint32 &position,
Card *card);
45 [[nodiscard]]
Card *
Top()
const;
50 [[nodiscard]]
Card *
Get(int32 index)
const;
55 [[nodiscard]] int32
GetSize()
const;
63 GameObject *
clone()
override;
71 void Add(GameObject *
object)
override;
80 friend class GameplayScreen;
85 std::vector<Card *> m_Cards;
90 std::vector<Card *> m_OriginalLayoutCards;
92 int32 m_MovesRequiredToWin = -1;
102 struct LastMove m_LastMove;
124 std::array<CardStack *, TABLEAU_STACKS>
Tableau;
134 static Deck Random(
bool useSeed =
false, int32 seed = 0);
Represents a playing card in a game. This class defines a card with properties such as color,...
Definition Card.h:61
Represents a stack of cards in the game.
Definition Deck.h:14
int32 GetSize() const
Returns the number of cards in the stack.
Definition Card.cpp:113
Card * Top() const
Returns the top card of the stack.
Definition Card.cpp:83
int32 FindIndex(Card *card) const
Finds the index of a specific card in the stack.
Definition Card.cpp:91
int32 GetBaseSize() const
Returns the base size of the stack.
Definition Card.cpp:176
void Remove(Card *card)
Removes the specified card from the stack.
Definition Card.cpp:81
Card * Get(int32 index) const
Returns the card at the given index.
Definition Card.cpp:93
void Add(GameObject *object) override
Adds a game object to the card stack.
Definition Card.cpp:104
void Insert(const uint32 &position, Card *card)
Inserts a card at the specified position in the stack.
Definition Card.cpp:69
GameObject * clone() override
Definition Card.cpp:179
String GetIdentifer() const override
Definition Card.cpp:181
void RegisterDeck(Phosphorus::GameObjectRegistry *registry) const
Registers the deck and its stacks to a registry.
Definition Card.cpp:372
static Deck Load(Phosphorus::GameObjectRegistry *registry)
Loads a deck from a game object registry.
Definition Card.cpp:338
bool Solve()
Attempts to solve deck (old solver).
Definition Card.cpp:395
Deck()=default
Constructs an empty deck.
std::array< CardStack *, TABLEAU_STACKS > Tableau
Array of tableau card stacks.
Definition Deck.h:124
std::array< CardStack *, TABLEAU_FOUNDATIONS > Foundations
Array of foundation card stacks.
Definition Deck.h:129
CardStack * Stock
Pointer to the stock card stack.
Definition Deck.h:119
bool IsAllFlipped()
Checks whether all cards are flipped.
Definition Card.cpp:386
bool EnsureSolvable(int32 *moves=nullptr)
Tries to solve deck.
Definition Card.cpp:115
static int32 SolvableLongMode()
Returns a seed for a solvable deck.
Definition Card.cpp:221
~Deck()
Destructor for the deck.
Definition Card.cpp:559
static Deck Solved()
Creates a solved deck with cards in right order.
Definition Card.cpp:183
static Deck Random(bool useSeed=false, int32 seed=0)
Creates a deck with cards in random order.
Definition Card.cpp:282
Storage of GameObjects (scene). GameObjectRegistry take over ownership of object.
Definition GameObject.h:372
Represents GameObject with children.
Definition GameObject.h:449
Represents a mutable sequence of characters, providing various member functions for string manipulati...
Definition String.h:16