-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.h
More file actions
55 lines (49 loc) · 1.34 KB
/
model.h
File metadata and controls
55 lines (49 loc) · 1.34 KB
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
/*
* Straights card game implementation
* References MVC lecture code example
*
* Model class. Is responsible for keeping track of the deck of cards.
* It knows nothing about views or controllers.
*
*/
#ifndef MODEL_H
#define MODEL_H
#include "subject.h"
#include "player.h"
#include "table.h"
#include "deck.h"
#include <string>
#include <vector>
#include <stdexcept>
#include <random>
class Model : public Subject {
std::default_random_engine rng;
Table *table;
std::vector<Player*> players;
std::vector<char> playerType;
Deck *deck;
int currentPlayer;
bool firstRound;
int moves;
public:
Model();
~Model();
void startGame(int seed); // new game
void setPlayerType(int id, char type); // sets player as human/ computer
void startRound(); // new round
Player* getCurrentPlayer();
void playCard(std::string card); // current player plays card
void discardCard(std::string card); // current player discards card
void next();
void endRound(); // calculates score at the end of each round and determines if game continues
void rageQuit(); // current player rage quits
//void quit();
void displayDeck();
void displayClubs();
void displayDiamonds();
void displayHearts();
void displaySpades();
void displayHand();
void displayLegalPlays();
};
#endif