Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
** EPITECH PROJECT, 2024 |
3 |
|
|
** zappy/ai |
4 |
|
|
** File description: |
5 |
|
|
** BotState.cpp |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
#include "BotState.hpp" |
9 |
|
|
|
10 |
|
|
std::map<Job, std::string> jobMap = { |
11 |
|
|
{FORKER, "FORKER"}, |
12 |
|
|
{SIMPLE_BOT, "SIMPLE_BOT"}, |
13 |
|
|
}; |
14 |
|
|
|
15 |
|
|
std::map<State, std::string> stateMap = { |
16 |
|
|
{STANDARD, "STANDARD"}, |
17 |
|
|
{FORKED, "FORKED"}, |
18 |
|
|
{WAIT_FOR_SERVER_RESPONSE, "WAIT_FOR_SERVER_RESPONSE"}, |
19 |
|
|
{WAIT_FOR_BROADCAST_RESPONSE, "WAIT_FOR_BROADCAST_RESPONSE"}, |
20 |
|
|
{ACT_ON_SERVER, "ACT_ON_SERVER"}, |
21 |
|
|
{ACT_ON_BROADCAST, "ACT_ON_BROADCAST"}, |
22 |
|
|
}; |
23 |
|
|
|
24 |
|
✗ |
BotState::BotState() : lastAction("", 0) |
25 |
|
|
{ |
26 |
|
✗ |
} |
27 |
|
|
|
28 |
|
✗ |
BotState::~BotState() |
29 |
|
|
{ |
30 |
|
✗ |
} |
31 |
|
|
|
32 |
|
✗ |
void BotState::printMetadata() const |
33 |
|
|
{ |
34 |
|
✗ |
for (auto &meta : metadata) |
35 |
|
|
{ |
36 |
|
✗ |
printKeyValueColored(meta.first, meta.second); |
37 |
|
|
} |
38 |
|
✗ |
} |
39 |
|
|
|
40 |
|
✗ |
const std::string getStateName(State state) |
41 |
|
|
{ |
42 |
|
✗ |
return stateMap[state]; |
43 |
|
|
} |
44 |
|
|
|