-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.cpp
37 lines (34 loc) · 832 Bytes
/
Player.cpp
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
// /////////////////////////////////////////////////////////
//
// File: clerdle/Player.cpp
// Author: Michael Foster
// Date: 2022.04.29
//
// The player class holds game history data for a
// particular player. This includes their name and games
// beaten in n number of rounds.
//
// /////////////////////////////////////////////////////////
#include "Player.h"
//---------------//
#include <string>
#include <map>
void Player::setHistory(const std::map<std::string, int> &history)
{
this->history_ = history;
}
void Player::setOne(std::string id, int value)
{
this->history_[id] = value;
}
void Player::increment(std::string id)
{
if (this->history_.find(id) != this->history_.end())
this->history_[id]++;
else
this->history_[id] = 1;
}
int Player::getOne(std::string id)
{
return this->history_[id];
}