-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame.h
84 lines (62 loc) · 2.05 KB
/
Game.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef ASSIGN2_GAME_H
#define ASSIGN2_GAME_H
#include "Player.h"
#include "GameBoard.h"
#include "LinkedList.h"
#include "constants.h"
#include "Tile.h"
#include <vector>
#include <string>
#include <memory>
#include <random>
#include <algorithm>
#include <chrono>
#include <iostream>
class Game {
public:
// Constructor to create a new Game
explicit Game(const std::vector<SharedPlayer>& players,
std::shared_ptr<std::map<string, bool>> enhancementsToStatusMap);
// Constructor to create a loaded Game
Game(const SharedVector<SharedPlayer>& players, SharedPlayer currentPlayer,
std::shared_ptr<GameBoard> board, std::shared_ptr<LinkedList> tileBag,
std::shared_ptr<std::map<string, bool>> enhancementsToStatusMap);
// Destructor
~Game();
/**
* Whether the game has finished and there's a winner
*/
bool isFinished();
// toString method
string toString(bool isColour, bool isSaving);
//initializing the game method
void initiation(unsigned int seed);
/**
* Blocking method which starts the game and doesn't return until the game
* is finished.
*/
void start();
private:
// Class Variables
std::shared_ptr<GameBoard> board;
std::shared_ptr<LinkedList> tileBag;
SharedVector<SharedPlayer> players;
SharedPlayer currentPlayer;
std::shared_ptr<std::map<string, bool>> enhancementsToStatusMap;
// Helper methods
/**
* Moves the game to the next player turn
* @return the next player
*/
SharedPlayer nextPlayerTurn();
//Initialize when creating a new game
void shuffleTileBag(std::vector<SharedTile> tileVector, unsigned int seed);
void setUpPlayerHands();
std::vector<SharedTile> createTileBag();
void saveCommand(std::stringstream& args);
void placeCommand(std::stringstream& args);
void replaceCommand(std::stringstream& args);
void printPlayerScores();
void printWinningPlayer();
};
#endif // ASSIGN2_GAME_H