forked from ChicoState/SportStats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame.h
48 lines (38 loc) · 1.08 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
/*
Comments
*/
#ifndef GAME_H
#define GAME_H
#include "Player.h"
#include <string>
#include <vector>
const int TEAMS = 2;
const Player DEFAULT_PLAYER = Player("NA",999);
struct goal_t
{
Player scorer = DEFAULT_PLAYER;
int team; // 1-indexed
int period; // 1-indexed
};
class Game
{
private:
int current_period;
std::vector <Player> roster[TEAMS];
std::vector <goal_t> goals;
Player get_player_by_name(std::string);
std::vector <Player> get_roster_from_file(std::string);
public:
// Initiates rosters from the file names provided for team 1 and team 2 and
// begins the game in period 1
Game(std::string, std::string);
// Records a player's goal in the current period for the team containing
// the player name provided (or does nothing if no matching names)
void add_goal(std::string);
// Progresses the current period to the subsequent period #, with no limit
// for the number of periods
void next_period();
// Retrieves the list of goal data in chronological order
std::vector <goal_t> get_goals();
};
#endif