Skip to content

Latest commit

 

History

History
110 lines (67 loc) · 4.55 KB

README.md

File metadata and controls

110 lines (67 loc) · 4.55 KB

Battlesnake Quickstart Snake Examples

Build Status Codacy Badge

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.

Open in Gitpod Deploy on Heroku Run on Repl.it

Snake Definitions

Visit Battlesnake Quickstart for a description of how to define kotlin and java snakes.

Snake Examples

Kotlin

Java

Clone your own snake

Use the Battlesnake Template to clone the code for your own snake.

Snake Execution

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.

Deployment Options

localhost

Use localtunnel to make a locally running snake visible to the Battlesnake server.

  1. Run localtunnel with: lt --port 8080

  2. Use the URL returned as your snake URL.

  3. 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.

  1. Run ngrok with: ngrok http 8080

  2. Use either of the Forwarding URLs displayed in the ngrok console as your snake URL.

  3. Follow the Snake Execution instructions to run a snake.

  1. Click on the Open in Gitpod badge above.

  2. Follow the Snake Execution instructions to run a snake.

  3. After starting the snake, click on Open Preview on the pop-up window.

  4. Use the URL displayed in the Gitpod browser window as your snake URL. You can also visit the /info endpoint for more information.

  1. Click on the run on repl.it badge above.

  2. Follow the Snake Execution instructions to run a snake.

  3. Use the URL displayed in the repl.it browser window as your snake URL. You can also visit the /info endpoint for more information.

  1. Create a new Heroku app with: heroku create [APP_NAME]

  2. Deploy code to Heroku with: git push heroku master

  3. Open the Heroku app in a browser with: heroku open or visit http://APP_NAME.herokuapp.com.

  4. Use the Heroku URL address as your snake URL. You can also visit the /info endpoint for more information.

  5. View the server logs with: heroku logs --tail