A collection of simple Battlesnakes written in Kotlin and Java using the Battlesnake Quickstart framework.
Visit Battlesnake.io for API documentation and instructions for creating a game.
Visit Battlesnake Quickstart for a description of how to define kotlin and java snakes.
Use the Battlesnake Template to clone the code for your own snake.
A server can support running multiple snakes, but they must be the same snake object type.
Assign the mainName
variable in build.gradle to the desired fully qualified
snake classname. For example:
def mainName = 'io.battlesnake.examples.kotlin.PerimeterSnakeWithLists'
You can run a snake with a script or as an uberjar:
-
Build and run the script build/install/battlesnake-examples/bin/snake with:
make script
. -
Build and run the uberjar build/libs/snake.jar with:
make uber
.
Use localtunnel to make a locally running snake visible to the Battlesnake server.
-
Run localtunnel with:
lt --port 8080
-
Use the URL returned as your snake URL.
-
Follow the Snake Execution instructions to run a snake.
You can also use ngrok, but unpaid users may experience "429 Too Many Requests" errors, which will cause your snake to move UP.
-
Run ngrok with:
ngrok http 8080
-
Use either of the
Forwarding
URLs displayed in the ngrok console as your snake URL. -
Follow the Snake Execution instructions to run a snake.
-
Click on the Open in Gitpod badge above.
-
Follow the Snake Execution instructions to run a snake.
-
After starting the snake, click on Open Preview on the pop-up window.
-
Use the URL displayed in the Gitpod browser window as your snake URL. You can also visit the /info endpoint for more information.
-
Click on the run on repl.it badge above.
-
Follow the Snake Execution instructions to run a snake.
-
Use the URL displayed in the repl.it browser window as your snake URL. You can also visit the /info endpoint for more information.
-
Create a new Heroku app with:
heroku create [APP_NAME]
-
Deploy code to Heroku with:
git push heroku master
-
Open the Heroku app in a browser with:
heroku open
or visit http://APP_NAME.herokuapp.com. -
Use the Heroku URL address as your snake URL. You can also visit the /info endpoint for more information.
-
View the server logs with:
heroku logs --tail