To kick off March, Pretio Interactive proudly returned to Battlesnake, the hugely popular competition put on by our friends at SendWithUs. Pretio returned for its 3rd year as a competitor and, for the first time, a sponsor.
(You may remember Pretio and its never-to-be-forgotten Chicken Snake. Our CTO, Rob O’Dwyer, built a snake with the strategy to always run away from its competitors.)
So what is BattleSnake? BattleSnake is a programming competition modeled after the retro videogame Snake, where students and web-developers program a web-based AI snake to navigate a board, eat food and avoid running into snake tails (including its own). However, to add a level of difficulty, every time a snake eats food their tail grows… thus making the board harder to navigate.
To help explain our strategy, I asked our Project Manager, Serge Predolin-Yager, to share the down-low and insights. As he explained, Pretio created two snakes, both driven by an impressive AI: a “Bounty Snake” (calledMirror Snake) that contestants could challenge in one-off competitions for prizes, and Pretio’s own mainstage competitor, Swift Snake.
Mirror Snake was programmed to copy whatever an opposing snake did, but one turn later. For example, if the opposing snake went left, a turn later we too would go left. Our snake was given basic AI survival instincts to avoid running into walls and into its own tail. But other than that, it would always mirror the opposing snake.
For competitors to defeat our bounty snake, they had to beat Mirror Snake before starving to death. We chose this as our strategy because we wanted to see how aggressive opposing snakes could be. To beat our snake, challengers had to not only get food, but then turn around and attack.
Sounds simple, right? No so fast. Over the course of the all-day event, only two teams managed to defeat Mirror Snake. Why? Well, we knew that many snakes are built to only survive: they hope to outlast opposing snakes rather than actively challenge each other. As such, very few snakes were able to actually claim the bounty.
Just like the original T-Swift, we built Swift Snake to be our MVP. Not only did it sing Shake It Off while playing, but its survival instincts along with its intent to be aggressive made it one of the few attack strategies seen this year.
What made Swift Snake so aggressive? Well, it was built with the goal to either eat or to kill. To get there, it would have to evaluate all possible targets and then take the shortest path to said target.
If the target was food, it would continue to eat until it was longer than at least one of its competitors. However, when it came to a one-on-one, instead of trying to win the match, Swift Snake would try to force a tie by allowing a head on collision with the other last snake. The idea behind this strategy was that we would likely suffer from a timeout or an unexpected bug condition, so it was in our best interests to end the match was soon as possible.
The event was, as always, a blast. We had a larger team presence and took away some snake learnings:
- From a technical perspective, it would have been best to use an EC2 instance with good network throughput because we suffered from default timeouts due to the micro-instance provided by Heroku.
- On the strategic end, we would like to have reviewed all pathways leading away from our target once we had met, allowing us to have at least 10 more moves after consumption.
With this, we challenge you to come at us at Battlesnake 2018!