#pragma once #include "../Pieces/Piece.h" #include "PiecesList.h" #include #include #include /** * A litteral bag of pieces, in which you take each of its piece randomly one by one then start again with a new bag */ class Bag { private: std::shared_ptr piecesList; // the list of loaded pieces std::vector> selectedPieces; // the list of pieces that can be given to the player std::pair next; // the next piece to give std::vector> currentBag; // the list of pieces that are still to be taken out before starting a new bag std::vector> nextBag; // the list of pieces that have been taken out of the current bag and have been placed in the next public: /** * Creates a new bag with the pieces currently selected in the piece list */ Bag(const std::shared_ptr& piecesList); /** * Ignores the remaining pieces in the current bag and startd fresh from a new bag */ void jumpToNextBag(); /** * Looks at what the next picked piece will be, without removing it from the bag * @return The next piece */ Piece lookNext(); /** * Picks a new piece from the current bag, removing it from the bag * @return The next piece */ Piece getNext(); private: /** * Prepare the next picked piece in advance */ void prepareNext(); };