Build the behavior for your Snek and upload it at sneks.dev/submit to see how it does against other submitters. See the website for live results and details regarding scoring and submission help.
- Install Python >=3.12 from python.org/downloads
- Add Python to your Path to make things easier
- (Optional) Install an IDE to work in
- Download
template.zip
to your local machine from sneks.dev/template/template.zip and extract its contents.
- Open a terminal or command prompt
- Change to the directory where the template is located. After unzipping, it should be the directory called
toroidal-sneks-submission-main
.- You should be located in the same directory as
pyproject.toml
- You should be located in the same directory as
- (Optional, but recommended) Set up a virtual environment
- Create virtual environment
python -m venv venv
- Activate the environment
- macOS / Linux
source venv/bin/activate
- Windows
venv\Scripts\activate
- If you get an error saying your execution policy prevents the running of the activate script,
you can disable that policy temporarily with
Set-ExecutionPolicy Unrestricted -Scope Process
.
- If you get an error saying your execution policy prevents the running of the activate script,
you can disable that policy temporarily with
- macOS / Linux
- Create virtual environment
- Install this package to enable testing locally
pip install --editable .
- Ensure everything works by trying out the helper scripts
- Test that the current snake passes validation
validate
- Run the current snake by itself
run
- Test that the current snake passes validation
In src/submission/submission.py
, modify the logic of get_next_direction()
to control your Snek's behavior. See sneks.dev/docs for documentation of
the classes and helper functions available to help refine your Snek. There are also a couple example Sneks
in src/examples
that can be used as starting points.
In src/scripts/config.py
, there are some values that can be changed to tune how the game performs locally. Each step
in the game has a delay afterwards, defaulting to 40ms. Likewise, after the end of a run, the game pauses for a default
of one second. These can be changed to your liking, with the added option of requiring a keypress to advance the snake.
With either WAIT_FOR_KEYPRESS
option set to True
, the snake will not move unless a key is pressed. Holding down a
key will continuously advance the snake.
If directed by your contest coordinator, you can use the following command to update the submission template dependencies to the latest version:
pip install --upgrade --upgrade-strategy eager --editable .