Skip to content

Commit

Permalink
feat(ia-shared): Evobot setup
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinbol committed Jun 23, 2024
1 parent a4d129a commit 06cccd2
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/ai/src/bots/EvoBot.cpp
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;
}
}
19 changes: 19 additions & 0 deletions src/ai/src/bots/EvoBot.hpp
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_

0 comments on commit 06cccd2

Please sign in to comment.