The Snake game

Snake console game written in VB.NETWow, almost a full year since my last post.

Anyway, here’s a little piece of code that (kind of) mimics the Blockade game, written in VB.NET.
Not much to say or comment about it, but that it is not a finished product and it’s just the result of an extremely boring afternoon… enjoy!


The game is kind of cool though, mainly because of its simple rules:

  • When the game starts, you are a snake with a head and a tail measuring 1 unit.
  • Maneuver the snake to eat the dots that will randomly appear on the screen.
  • Each dot you eat will grow your snake’s tail based on its color:
    • █ Gray = 1
    • █ Yellow =2
    • █ Green = 3
    • █ Blue = 4
    • █ Red = 5
  • You are given a limited amount of time to eat each dot. Those dots that you fail to eat in time will shrink your snake accordingly.
    For example, if you fail to eat a █ Blue dot, your snake’s tail will shrink by 4 units.
  • You will loose whenever your snake:
    • Hits a wall
    • Hits it self
    • It’s tail shrinks too much

Besides the game mechanics, there’s also a kind of interesting class that is used to render the “non-standard” text on the screen, such as that used for the title screen as well as for the Game Over banner.

The class, when instantiated, will generate an ASCII character set based on the graphic representation of a truetype font. Although the class is barely used in the game, I think it has the potential to be quite useful in many future console-based applications.

Here’s a link to download the source code (and binaries) for Visual Studio:

Snake (1247 downloads )

If you decide to enhance the game, please share your changes in the comments below or in the forums. I’d love yo see what you can come up with.

For example, I’d love to implement support to double the vertical resolution. This way, instead of using the character for the snake, its tail and its food, we’d use  ▄ and ▀ to divide a single character position into two.

Do you think you can do it before I get bored again?