Welcome to Sneks’ documentation!
Sneks in SPACE
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.
Getting started
Prerequisites
Install Python >=3.10 from python.org/downloads
Add Python to your Path to make things easier
(Optional) Install an IDE to work in
PyCharm Community Edition (Note: scroll down for the free Community edition)
Download
template.zip
to your local machine from sneks.dev/template/template.zip and extract its contents.
Set up development environment
Open a terminal or command prompt
Change to the directory where the template is located. After unzipping, it should be the directory called
space-sneks-submission-main
.You should be located in the same directory as
pyproject.toml
(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
.
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
Develop your Snek
In src/submission/submission.py
, modify the logic of get_next_action()
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.
Configuration
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.
Updating the submission template dependencies
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 .
Contents: