HTTP Hacks starts now!

Here's everything you need to know!

Housekeeping

  1. The in-person portion starts at 9 AM this Sunday and will run until approximately 7 PM.
  2. Light breakfast, lunch, and dinner will be provided.
  3. Final evaluation (note how we didn't say submission) will begin at 5ish

The Challenge

Here it is: we're building Battlesnakes. You can read more about what a Battlesnake is and find all the information you need on the documentation page.

TL;DR: You build an API that parses a JSON representation of a game board, decides on the best possible move, and responds, all within 500 ms. Your opponent(s) on the board do the same. You can use your elite knowledge of data structures and algorithms, tap into some machine learning magic, or even just cover every edge case with if statements (you'd be surprised how well this can work).

There are plenty of resources available, including starter templates in Python, Go, Rust, JavaScript, and other languages.

The JSON API response format is standard and fixed. Our API will use the same format.

Between now and then

  • You're welcome to start coding right now if you wish, but we suggest taking some time to understand how Battlesnake works first.

  • We recommend running a template snake on localhost and using the Rules CLI to run a local game and see how things work. Try using the --browser flag to better understand the game. You don't have to do this, but it will make testing much easier when developing your snake. Otherwise, you'll need to deploy it to use the play.battlesnake.com engine.

  • After watching a game or two, once you have an idea of how Battlesnake works, start thinking about how you can improve your snake!

  • We gave this problem to every major coding agent and AI model already, and the solutions they came up with were pretty mid. You're welcome to use AI for the challenge, but a level of critical thinking skills, creative problem solving, thinking outside the box, and strong fundamentals will easily defeat a pure chatGPT solution.

Submission & Evaluation Details

Your Battlesnake will be evaluated by our API, which will run hundreds of games against one or more snakes from other teams.

To submit your snake, we recommend hosting your code and providing us with its URL. This will help minimize latency and give your snake as much time as possible to respond to requests.

  • We'll have people available to help you deploy if you've never done so before. We suggest setting up deployment early so you aren't worrying about it later.

  • Our API will be running on Fly.io in a Western North America region. Using any major hosting provider should be sufficient.

  • If you really don't want to figure out hosting, you can use a Cloudflare Tunnel or a Pyjam Tunnel. However, you'll need to leave your laptop running for the entire evaluation period.

  • Make sure you aren't using a provider that puts your deployed code to sleep (like Render's free tier), so your snake can respond in time.

  • You don't need to worry about TLS. We're happy with either HTTP or HTTPS URLs since the API doesn't handle sensitive information.

  • We'll ask you to give us a short (1–2 minute) rundown of how your snake works, the strategies it uses, which language you chose and why ("I only know Python" is a valid answer!), along with any other interesting or technical information you'd like to share.

Questions?

Shoot us a message in the Computing Club Discord or send us an email at [email protected].

Game State

Here's an example of a game state JSON object that your code would receive from the game engine.

{
  "game": {
    "id": "824f012d-f1cb-43f0-b4dc-9ba2f04a03f8",
    "ruleset": {
      "name": "standard",
      "settings": {
        "foodSpawnChance": 15,
        "minimumFood": 1
      }
    },
    "map": "standard",
    "timeout": 500
  },
  "turn": 156,
  "board": {
    "height": 11,
    "width": 11,
    "snakes": [
      {
        "id": "gs_HjQd9xYVQ9rctX7PgRTCvCv8",
        "name": "SMUS_Danger_Noodle",
        "health": 73,
        "body": [
          { "x": 6, "y": 4 },
          { "x": 5, "y": 4 },
          { "x": 4, "y": 4 },
          { "x": 3, "y": 4 },
          { "x": 3, "y": 3 },
          { "x": 2, "y": 3 },
          { "x": 2, "y": 2 },
          { "x": 2, "y": 1 },
          { "x": 3, "y": 1 },
          { "x": 3, "y": 2 },
          { "x": 4, "y": 2 }
        ],
        "head": { "x": 6, "y": 4 },
        "length": 11
      }
    ],
    "food": [
      { "x": 10, "y": 0 },
      { "x": 2, "y": 0 },
      { "x": 1, "y": 10 },
      { "x": 10, "y": 8 },
      { "x": 0, "y": 9 },
      { "x": 6, "y": 1 },
      { "x": 1, "y": 0 },
      { "x": 8, "y": 8 },
      { "x": 0, "y": 10 },
      { "x": 6, "y": 9 }
    ]
  },
  "you": {
    "id": "gs_HjQd9xYVQ9rctX7PgRTCvCv8",
    "name": "SMUS_Danger_Noodle",
    "health": 73,
    "body": [
      { "x": 6, "y": 4 },
      { "x": 5, "y": 4 },
      { "x": 4, "y": 4 },
      { "x": 3, "y": 4 },
      { "x": 3, "y": 3 },
      { "x": 2, "y": 3 },
      { "x": 2, "y": 2 },
      { "x": 2, "y": 1 },
      { "x": 3, "y": 1 },
      { "x": 3, "y": 2 },
      { "x": 4, "y": 2 }
    ],
    "head": { "x": 6, "y": 4 },
    "length": 11
  }
}