-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.h
53 lines (48 loc) · 2.09 KB
/
Player.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
/*
* File: Player.h
* Author: Jason
*
* Created on April 1, 2021, 8:25 AM
*/
/*****************************************************************************\
* This header will contain the players hands and the display of the card in *
* play *
\*****************************************************************************/
#ifndef PLAYER_H
#define PLAYER_H
#include "Card.h"
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
/*****************************************************************************\
* Player *
* The Player class will contain the attributes of the player. *
* Attributes: players name string, hand in play stack, cards won vector, *
* war cards queue. *
\*****************************************************************************/
class Player
{
private:
string playerName; // hold players name.
public:
// hand in play used to pull cards from for each play a stack was used
// for its simple nature only the top card needs to be accessed.
stack<Card> handInPlay;
// cards won is used to hold all the cards won from battles and wars
// a vector was used so that once the cards in hand in play run out
// we can simply use an algorithm to shuffle the cards before returning
// them to the hand in play.
vector<Card> cardsWon;
// the war queue is used to hold the cards offered for war as well as
// the cards that initiate the war in the first place. A queue was used
// to fulfill the assignment requirements.
queue<Card> war;
void displayTopCard(); // displays top card.
void printHand(); // used to print the hand for testing.
void shuffleIn(); // shuffles the cards won and returns them to the hand in play.
void setName(string ); // setter for the player name.
string getName(); // getter for the player name.
};
#endif /* PLAYER_H */