The Perfect Snake
Written by Mike James   
Saturday, 13 April 2013

Snake is still a well known game because of its suitability for  mobile phones - but did you know it was possible to win? We have a video for you that shows a perfect game of snake and it is fascinating and mesmerizing as a display of strategy.

The gif below was  posted to a Russian website, by a user with the name Dozen. It isn't clear how the gif came to be made or why, but it has been featured on Reddit and The Huffington Post and, while going "viral" might be too strong a term, it does seem to be gained a lot of popularity.

In case you have missed out on the delights of Snake all you have to do is steer the snake around the screen so that it eats the pellets. The problem is that each pellet makes the snake longer and it gets increasing difficult to avoid running into your own tail. 

Even though I have written Snake more than once, it had never occurred to be that there might be a "solution" in the sense of a movement strategy that allows the maximum number of pellets to be eaten and the snake to grow to the full size of the screen. This animated gif proves that there is. The game took 13 minutes 17 seconds in real time and is speeded up to about 2 minutes in the gif. The snake eats 100 pellets and reaches a length of 801 blocks which fills the screen and ends the game. 

When you watch the play notice some of the techniques used to avoid the tail - I personally love the wiggle that packs the tail into a shorter length so that the head can have some space to move. There are some amazing moves to reach the pellet towards the end of the game that have to be defined as strategic - no simple greedy algorithm is at work here!




 According to a number of comments the final screen reads:

“And now we’ll show you a cartoon. Connection to server … No connection. Thanks. Everybody’s free to go.”

which it is speculated is a reference to an urban myth that a well known game would show you a cartoon if you scored 1000. 

So I suppose the challenge is now to improve Snake so that it is more difficult to win but still winnable. Or you could choose the other side of the coin and write an AI bot to play any randomized snake game perfectly. 




More Information

Original message board post

Hufffington post

Related Articles

Windows Phone 7 - Snakes on a Phone Part 1       

Snake - using the GDI+


To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, FacebookGoogle+ or Linkedin,  or sign up for our weekly newsletter.






or email your comment to:



IEEE Spectrum Ranks Languages

IEEE Spectrum has repeated its annual exercise to rank programming languages in terms of their popularity and once again it is Python that emerges as the front runner in its rankings. However, Python  [ ... ]

Geoffrey Hinton Awarded Royal Society's Premier Medal

Geoffrey Hinton, pioneer of neural networks and deep learning, has been awarded a Royal Medal by the Royal Society, the UK's national academy of sciences. 

More News


Last Updated ( Saturday, 13 April 2013 )