-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4d129a
commit 06cccd2
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** zappy/ai | ||
** File description: | ||
** Slave.cpp | ||
*/ | ||
|
||
#include "EvoBot.hpp" | ||
|
||
void EvoBot::initChild() | ||
{ | ||
std::cout << "🧒✅ EvoBot initialized" << std::endl; | ||
} | ||
|
||
void EvoBot::updateStrategy() | ||
{ | ||
printf("SLAVE! : "); | ||
for (auto &_allyMessage : _alliesMessage) { | ||
if (_allyMessage.content.find("send_ressources") != std::string::npos && _state.level == 2 && (_state.lastAction.action != INCANTATION)) { | ||
std::string _msg = "{EVOBOT}" + std::to_string(_id) + "/i_have_ressources?" + | ||
"linemate=" + std::to_string(_state.ressources.linemate) + "|" + | ||
"deraumere=" + std::to_string(_state.ressources.deraumere) + "|" + | ||
"sibur=" + std::to_string(_state.ressources.sibur) + "|" + | ||
"mendiane=" + std::to_string(_state.ressources.mendiane) + "|" + | ||
"phiras=" + std::to_string(_state.ressources.phiras) + "|" + | ||
"thystame=" + std::to_string(_state.ressources.thystame) + "&" + std::to_string(_state.level); | ||
std::cout << _msg << std::endl; | ||
_message.format(_msg); | ||
queue.push_back(std::make_pair([&]() | ||
{ doAction(BROADCAST, _message.content); }, "BROADCAST")); | ||
} | ||
if (_allyMessage.content.find("group") != std::string::npos) { | ||
std::cout << "We need to Group" << std::endl; | ||
} | ||
} | ||
if (_state.ressources.food < 5) { | ||
survive(); | ||
return; | ||
} | ||
else if (_state.level == 1 && _state.ressources.linemate != 1) { | ||
searchAndTakeRessource("linemate"); | ||
return; | ||
} | ||
else if (_state.ressources.linemate == 1 && _state.level == 1) { | ||
incantationLvl1(); | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** zappy/ai | ||
** File description: | ||
** SimpleBot.hpp | ||
*/ | ||
|
||
#ifndef EVOBOT_HPP_ | ||
#define EVOBOT_HPP_ | ||
|
||
#include "ABotPattern.hpp" | ||
|
||
class EvoBot : public ABotPattern | ||
{ | ||
public: | ||
void initChild(); | ||
void updateStrategy() override; | ||
}; | ||
#endif // SIMPLEBOT_HPP_ |