To start building your own CORE bot, ensure you've completed the following prerequisites:
Be a Registered CORE Participant/Team ✨
Receive Your CORE Repository Invite 📧
Follow these steps to set up your development environment using GitHub, Docker, and Visual Studio Code.
When cloning with SSH you might need to push from a terminal from outside the Dev Container for it to work
- Open a terminal and run:
git clone <your-repo-url>
- After cloning, open the project in Visual Studio Code (VSCode).
make
command:
make
localhost
(no port number) in the address bar.When running make again you might have to reload the visualizer page for it to work!
- Navigate to the
src/
folder inside the container (Every .c file in there should get compiled).
🎉 You are now ready to start coding! 😎
Here's a simple example bot to get you started.
void ft_user_loop(void *data)
{
(void)data;
// get all units of own team
t_obj **units = ft_get_my_units();
// get the first opponent core there is
t_obj *enemy_core = ft_get_first_opponent_core();
ft_create_type_id(UNIT_WARRIOR); // try to create a warrior
int i = -1;
while (units[++i]) // loop through every of our units
{
t_obj *curr = units[i];
if (curr->s_unit.type_id == UNIT_WARRIOR) // if the unit is a warrior
{
t_obj *war = ft_get_nearest_opponent_unit(curr); // try to get the closest core to current unit
if (war)
ft_travel_attack(curr, war); // travel and then attack to the obj
else
ft_travel_attack(curr, enemy_core);
}
}
free(units);
}