initial commit
This commit is contained in:
39
src/Core/Bag.h
Normal file
39
src/Core/Bag.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "../Pieces/Piece.h"
|
||||
|
||||
#include <Vector>
|
||||
|
||||
|
||||
/**
|
||||
* 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::vector<Piece> pieces; // the pieces the bag can dispense
|
||||
int next; // the next piece to give
|
||||
std::vector<int> currentBag; // the list of pieces that are still to be taken out before starting a new bag
|
||||
std::vector<int> 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 of the specified list of pieces
|
||||
*/
|
||||
Bag(const std::vector<Piece>& pieces);
|
||||
|
||||
/**
|
||||
* Looks at what the next picked piece will be
|
||||
*/
|
||||
Piece lookNext();
|
||||
|
||||
/**
|
||||
* Picks a new piece from the current bag
|
||||
*/
|
||||
Piece getNext();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Prepare the next picked piece in advance
|
||||
*/
|
||||
void prepareNext();
|
||||
};
|
||||
Reference in New Issue
Block a user