-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame.h
69 lines (56 loc) · 2.7 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
/*
Game.h
FACADE class
Declaration of Game class.
*/
#ifndef _GAME_H_
#define _GAME_H_
#include "Card.h"
#include "CardList.h"
#include "Deck.h"
#include "Observer.h"
#include <vector>
class Player; // forward declaration to prevent circular dependencies
// Game class - facade class
class Game {
public:
Game(); // constructor
~Game(); // destructor
//Accessors
int getCurrentPlayerId() const; // gets the id of the current player
int getScore(int) const; // gets the score of the given player
int getDiscardCount(int) const; // gets the number of discards by the given player
const CardList &getCurrentPlayerHand() const; // gets the hand of the current player
const CardList &getTable() const; // gets the table which is the cards already played
bool roundOver() const; // whether a round is over or not
bool gameDone() const; // whether game is over or not
bool winner(int) const; // whether given player won
const Card* hint() const; // gives a card as a hint
//Mutators
void makeHintRequest(); // makes a request for a hint
void seed(int); // allows to set seed value
void setPlayerType(int,bool); // sets what type (AI, HUMAN) the given player is
void playerRageQuit(); // performs a rage quit on the current player
bool play(const Card& card); // makes the current player play the given card, returns false if can not be played
void addToTable(const Card*); // adds the given card to the table (card was played)
void startNewGame(); // starts a new game - resets variables and table
void endGame(); // ends the current game
void newRound(); // resets the deck and hands out new cards
void endRound(); // ends the current round as cards are done (updates score)
void notify();
void subscribeView(Observer* observer); // Adds view to be observers of the Subject classes
private:
const int MAX_TURNS; // maximum number of plays
const int ENDGAME_SCORE ; // score at which game ends
int seed_; // value used in shuffling algorithm
int currPlayer_; // the player who is currently playing cards
int currTurn_; // the turn number to keep track of when game is over
bool roundOver_; // whether the current round is over
bool gameOver_; // whether game is over
std::vector<Player*> players_; // list of the players who are in the game
Deck game_deck_; // Deck of cards used to play the game
CardList table_; // played cards
void gameOver(); // Calculates winner
void cleanUpCards(); // clears all cards from hand, deck, table
};
#endif /* _GAME_H_ */