Howdy! This is the repo for Denison University's Coding Club Snake Programming Competition. Participants will code a Snake bot in C++ to face off against others. The winner will be crowned Coding Supreme.

The game is very similar to classic snake except there are two snakes. Every timestep, the head of each snake will go up, down, left, or right and a fruit will spawn on a regular interval. If the head of one snake runs into the edge, itself, or the other snake, it loses. If the heads of the snakes run into each other, the game is considered a draw. And of course, if a fruit is eaten, the snake gets longer.
If the game is not over at the start of the 100th time step, the longer snake will win or both draw if they are the same size.
Competitors will implement a bot to control their snake as detailed below.
Your bot will be implemented in src/MyBot.cpp, this is what will be submitted. You may write additional helper methods and functions but they must be contained within that single file and you may not modify the signature of the think function. You can of course create more scripts to test your bot, but in the end, MyBot.cpp is what will be submitted.
The think function is what will be called every time step and is what determines what your bot does. the think function returns a Direction and takes in a Grid as a parameter. See the documentation. The Grid class contains the information for what is on the board.
To start, you'll want to read the compilation instructions which also includes how to get the project set up for specifically VSCode. It'll guide you in installing a cpp compiler and running the project. If compiling provides a hurdle in you participating, sessions are being run every Thursday in Olin 311 from 7 to 8 pm to help with DU Slither!
When running this project, there are three options for testing:
src/EvilBot.) Evil bot is simply another bot you can customize to go against MyBot.After following the compilation instructions, you'll be able to select which option through the VSCode run and debug menu:

What is the competition format?
I'm having issues compiling and running the project
Can I use AI?
no.
Will there be resource limits on the bots?
Yes, but for the purpose of logistics rather than an actual limitation on you. Every bot will receive 2 gigs of ram, 1 gigahertz of CPU, and 5 seconds every game tick to think in the tournament. Unlike a computationally expensive game like Chess, computing the logic for this game should not reach anywhere near these limits unless you accidentally have an infinite loop.
Can I use the standard cpp library?
Yes, except for parts that obviously don't make sense such as network or IO. Also, you may not use std::srand, this is done already in main, just use std::rand.
I was heavily inspired by Sebastian Lague's Chess Challenge and this idea for two player snake was taken from one of his unfinished projects.