-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMachine.cpp
More file actions
33 lines (25 loc) · 1.02 KB
/
Machine.cpp
File metadata and controls
33 lines (25 loc) · 1.02 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
#include "Machine.hpp"
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <boost/log/trivial.hpp>
namespace Core
{
Machine* Machine::pinstance_{nullptr};
std::mutex Machine::mutex_;
Machine* Machine::GetInstance()
{
std::lock_guard<std::mutex> lock(mutex_);
if(pinstance_ == nullptr)
{
pinstance_ = new Machine();
}
return pinstance_;
}
Data::RoundResults Machine::processRound(const std::shared_ptr<Player>& aPlayer1, const std::shared_ptr<Player>& aPlayer2, const Data::GameResults& aGameResults)
{
Data::eDecisionType aPlayer1Decision = aPlayer1->makeDecision(aGameResults, Data::ePlayerNumber::One, _gameConfig._mistakeChance);
Data::eDecisionType aPlayer2Decision = aPlayer2->makeDecision(aGameResults, Data::ePlayerNumber::Two, _gameConfig._mistakeChance);
Data::RoundResults aRoundResults(aPlayer1Decision, aPlayer2Decision, _gameConfig);
return aRoundResults;
}
}