Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
** EPITECH PROJECT, 2024 |
3 |
|
|
** zappy/ai |
4 |
|
|
** File description: |
5 |
|
|
** ListenTakeResponse.cpp |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
#include "../../bots/ABot.hpp" |
9 |
|
|
|
10 |
|
|
// TODO: find a cleaner way to do this |
11 |
|
✗ |
void ABot::listenTakeResponse(const std::string &response) |
12 |
|
|
{ |
13 |
|
✗ |
if (_state.lastAction.parameter == "linemate") |
14 |
|
|
{ |
15 |
|
✗ |
if (response == "ok") |
16 |
|
|
{ |
17 |
|
✗ |
_state.ressources.linemate += 1; |
18 |
|
|
} |
19 |
|
|
} |
20 |
|
✗ |
else if (_state.lastAction.parameter == "deraumere") |
21 |
|
|
{ |
22 |
|
✗ |
if (response == "ok") |
23 |
|
|
{ |
24 |
|
✗ |
_state.ressources.deraumere += 1; |
25 |
|
|
} |
26 |
|
|
} |
27 |
|
✗ |
else if (_state.lastAction.parameter == "sibur") |
28 |
|
|
{ |
29 |
|
✗ |
if (response == "ok") |
30 |
|
|
{ |
31 |
|
✗ |
_state.ressources.sibur += 1; |
32 |
|
|
} |
33 |
|
|
} |
34 |
|
✗ |
else if (_state.lastAction.parameter == "mendiane") |
35 |
|
|
{ |
36 |
|
✗ |
if (response == "ok") |
37 |
|
|
{ |
38 |
|
✗ |
_state.ressources.mendiane += 1; |
39 |
|
|
} |
40 |
|
|
} |
41 |
|
✗ |
else if (_state.lastAction.parameter == "phiras") |
42 |
|
|
{ |
43 |
|
✗ |
if (response == "ok") |
44 |
|
|
{ |
45 |
|
✗ |
_state.ressources.phiras += 1; |
46 |
|
|
} |
47 |
|
|
} |
48 |
|
✗ |
else if (_state.lastAction.parameter == "thystame") |
49 |
|
|
{ |
50 |
|
✗ |
if (response == "ok") |
51 |
|
|
{ |
52 |
|
✗ |
_state.ressources.thystame += 1; |
53 |
|
|
} |
54 |
|
|
} |
55 |
|
✗ |
} |
56 |
|
|
|