The finals played between Snakunamatata (Mukunda) and Cherries are for Losers (Rinus). The finals were won by Snakunamatata with 3 against 2, congratulations!
Longest snake achieved was won by FurryMuncher (Ferry) who achieved a length of 58!
Most wins by lines of code was won by Bite my shiny metal ass!
- Bite my shiny metal ass: 8.2 (Jonothan)
- Explorer: 5.8 (Daniel)
- Apologetic Aphophis: 4.9 (Hein)
King of the hill was won by FurryMuncher!
Wins | Rate | CPU | CPU/t | Matches | Turns/m | Elo | |
---|---|---|---|---|---|---|---|
There is no Candy! (disqualified) | 876 | 97.3% | 110.6 | 9.881 | 900 | 12.4 | 2252.0 |
Snakunamatata | 687 | 76.3% | 950.2 | 7.239 | 900 | 145.8 | 1808.4 |
Cherries are for Losers | 615 | 68.3% | 1032.8 | 12.540 | 900 | 91.5 | 1717.0 |
Serpent of the Light | 587 | 65.2% | 582.3 | 6.719 | 900 | 96.3 | 1687.5 |
Explorer | 437 | 48.6% | 175.9 | 0.484 | 900 | 403.5 | 1526.1 |
FurryMuncher | 433 | 48.1% | 40.1 | 0.357 | 900 | 124.8 | 1510.8 |
Bite my shiny metal ass | 410 | 45.6% | 38.0 | 0.309 | 900 | 136.5 | 1483.0 |
Apologetic Apophis | 364 | 40.4% | 45.3 | 0.207 | 900 | 243.2 | 1434.5 |
Random | 72 | 8.0% | 42.3 | 0.304 | 900 | 154.5 | 819.1 |
Wolverine | 66 | 7.3% | 29.5 | 0.071 | 900 | 459.3 | 761.6 |
The goal is to beat all other bots playing snake. Each match is 1v1, each bot will be paired up with all other opponents. The bot with the most wins will win the tournament.
You should write your bot's logic in a Python class. Each turn a function on your bot will be called with the state of the game and the bot needs to decide in which direction to move.
There are two example bots implemented
Your bot will be initialized with an id and the size of the grid. The grid is specified by the amount of tiles in x and y.
def __init__(self, id: int, grid_size: Tuple[int, int]):
Each turn your bots determine_next_move
function will be called.
As in input it'll receive the state of the game.
With this information you should calculate and return which direction it should move in.
After this function call, the move will be applied and then it's the turn of the other player.
If you move against a wall or another player, you are dead.
def determine_next_move(self, snakes: List[Snake], candies: List[np.array]) -> Move:
How the bot implements this function is up to you. You can train an AI, do some path planning or implement a method to trap opponents.
- The exact rules of the game are implemented in snakes/game.py.
- If you go out-of-bounds, collide with another bot or return anything other than a Move, your bot will die.
- The amount of points you get is your longest achieved length.
- The longest surviving bot will get double the points. This promotes eating candies, otherwise bots will stay short and hide in the corner.
- There is a maximum turn limit of 10k turns (see snakes/constants.py). If there is no winner after these amount of turns have passed, the game is ended, both players survived the longest.
- You are allowed to submit a maximum of two bots.
- Your bot must be your own creation. This rule is so that you may not blatantly copy someone's bot, change only a few lines, and then submit it as your own. Some code duplication is of course inevitable and thus allowed, because the logic might be similar between bots.
- The code of the game is law. The rules of the game are implemented in the code. If you want to know the specific rules of the game, please look at the code. If the game determines you've won a game, that is the outcome.
- Please limit the processing time of your bot.
Currently, there's a hard limit of
100ms
average time-per-move as measured by tournament.py. Please talk to one of the organizers if you think this is too short. You can also use a profiler to try and make your code faster. - You can only use the Python libraries that are in the requirements.txt file. If you want to use another library, please let one of the organizers know.
- Multithreading is not allowed
- Targeting a specific other bot is not allowed, although you may target the tactics of a general class of bot. This means you are not allowed to use a bots ID to apply a specific strategy. This also means is also not allowed to detect your other bot and 'suicide' when encountered.
- You are not allowed to read or alter the game's internal state, or the state of the other bot. You can only use the information that is given via the interface.
Your bot will live as a git submodule inside the main challenge repository. This means you will need to create your own GitHub account and create a new repository based on a template. You can follow the following steps to create your own bot.
Note: You are allowed to submit a maximum of two bots.
- Create a GitHub account if you don't have one already. Using a personal account is fine.
- Create a personal repository where your bot will live. You can use the following repository template to do this for you: https://github.com/nobleans-playground/coding-challenge-snakes-bot-template
- Give your bot a custom name and add your name as contributor Notify an organizer @Rayman or @heinwessels to add your bot to the challenge as a submodule in the main repository. Note: Your bot doesn't have to be complete to be added, it simply needs to run and return a valid move. You can update/change/refactor your bot at any point during the challenge.
- Clone this repository using
git clone --recursive [email protected]:nobleans-playground/coding-challenge-snakes.git
. The--recursive
is to pull in all submodule bots. - Install all the dependencies
- On linux
sudo apt install -y python3-more-itertools python3-numpy python3-pandas python3-pygame python3-scipy
- On Windows
pip install -r requirements.txt
- On linux
- Run
tournament.py
or any of the other executables
- If you bot has NOT being added to the main repository, create a file in the ./snakes/bots folder. Don't forget to add it to the bots list in ./snakes/bots/init.py. See ./snakes/bots/random.py Random for inspiration
- If you bot has been added to the main repository, just edit the files in your own bots folder.
Over the course of the challenge your local repository might be out-of-date with all the other bots. To update the environent you can run the following two commands from the root folder.****
# Pull the latest game-code
git pull
# Pull the latest code from all the bots
git submodule update --remote
-
commandline.py: Battle 2 snakes against each other in the commandline.
-
tournament.py: Battle all bots against eachother in a tournament. It'll write the results to a csv file.
-
gui.py: Battle bots against eachother in a graphical user interface. In VSCode, press
F5
to run in debug mode. Use the following command to always have your bot as player 1, battling against a random bot.python gui.py --snake1 your-bot-name
-
elo.py: From the tournament results csv you can calculate your bots elo rating.