Preparing For Battlesnake

Mykal Machon
Mar 19, 2019 · 4 min read

This is a guest post by two-time Battlesnake participant and third-year Computer Science student Mykal Machon.

My snake AI (the pink, pixelated one) mid-match in the arena

This year’s Battlesnake competition takes place on March 2nd, 2019 at the Victoria Convention Center and I’ve got quite a bit of preparation to do before then.

But Wait a Second… What’s Battlesnake?

In the organizer’s words…

Battlesnake is a fun way to practice programming and learn new skills. Groups and individuals build AI bots to play the game Snake using modern, real-world technology. Read the docs, deploy your snake to a live web server, and join other programmers trying be the last snake slithering. (

If you’ve ever played the classic game snake on your phone or computer, you know exactly what a Battlesnake arena looks like.

Just imagine instead of one snake on the screen, there are 4–5 of them. All fighting for the same food and space with the best-programmed snake taking home a cash prize and the esteemed title of Battlesnake Champ.

Sounds fun right? I thought so! If you’re still not convinced, here’s a video.

My Goals for Battlesnake this Year

Since I’ve got the fundamentals down, I’m taking Battlesnake as an opportunity to spend some time sharpening my pathfinding skills and programming a snake that can at least sort of stand on its own two, metaphorical, legs.

While, in a perfect world, I’d be spending hours on this every night, I’ve got midterms the week of and the week after Battlesnake so I’m going to have to prioritize a little bit.

Priority #1: Self Sustaining

This is the minimum I’d like to get my snake AI to do.

At this level my snake should be able to:

  1. Not kill itself by running into its own body / other snakes / walls…

Priority #2: Basic Pathfinding

This is where my snake will realistically be before the competition.

At this level my snake should be able to:

  1. Do everything that a self-sustaining snake could do.

Priority #3: Getting Fancy

These are the things I think would be really cool to play around with, but doubt I will actually get to implement.

At this level my snake should be able to:

  1. Do everything a Basic Pathfinding snake could do.

I’ve never used any AI tech beyond using some very simple pre-trained facial recognition models. This would awesome to play around with but may be a little too far out of my wheelhouse to be achievable in two weeks.

Closing Thoughts

This is actually my second year attending BattleSnake. I first attended in 2017, my first year of university. I don’t think my team and I could even get the snake to change directions. We were all pretty inexperienced developers at the time and had never worked with, or even heard of, tools like Node.js or Heroku.

Despite our lack of knowledge, we had a ton of fun! The event’s atmosphere was awesome and I learned more about real-world development in that 5–6-hour event than I had all year in class. I remember feeling so proud that we even got our snake to respond with a 200 to the server.

It’s crazy to think that just two years ago I knew absolutely nothing about any of the technology I use on an almost daily basis today. I sometimes feel like I’m constantly losing a race with technology; like I can never learn enough, fast enough, to feel caught up and knowledgeable.

That said, being able to look back on my skills in 2017 and contrast them to my skills today through the lens of something like Battlesnake has really inspired me to prove to myself just how far I have come in that time. I can’t wait to start this year’s snake!

This post was originally written on February 18, 2019, for my personal blog. My snake AI went on to make it into the second round of the beginner's bracket 🎉! I’ve definitely made progress and I’m looking forward to making even more, come next year’s Battlesnake.


What if programming was fun and accessible for everyone?

Mykal Machon

Written by


What if programming was fun and accessible for everyone?

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade