Classic Snake game now playable in your browser URL address bar — JavaScript remake uses Unicode Braille characters to render the game

URL snake
(Image credit: Demian Ferreiro )

The classic Snake game squeezed a lot of entertainment onto the basic screens that 90s style dumb phones used to rely on. However, a new version of Snake, coded to run in your browser’s URL address bar, makes playing it on your old Nokia brick feel luxuriously high-res and futuristic. Despite the cramped confines of the URL bar, though, developer Demian Ferreiro must be applauded for keeping the fast, and precise, yet frustrating gameplay of the original intact.

URL Snake

(Image credit: Demian Ferreiro )

The animated GIF we’ve embedded gives you a flavor of URL Snake. This gameplay capture certainly puts my efforts to shame (best score = 2), showing my reflexes and timing aren’t really adequate for this kind of classic twitch gaming title.

Ferreiro candidly admits that URL snake “is kind of a joke.” Nevertheless, he is willing to refine the game and welcomes bug reports, ideas, and pull requests on the URL Snake GitHub repository.

Coding URL Snake

Via the GitHub page, you can take a look at URL Snake’s public domain code. The minimalist address bar-hosted app is coded in under 400 lines of JavaScript, utilizing Unicode manipulation for rendering the game in the URL bar, among its techniques.

On the topic of the game’s visuals, this particular edition of Snake runs in a 40x4 pixel grid, and RequestAnimationFrame is used for smooth rendering of the grid of Braille characters. Due to the limited vertical canvas of this version of the game, you'd better be prepared to change direction extremely quickly if you direct the snake to move up or down.

If you are wondering what inspired Ferreiro to code URL Snake, the developer seems to have actually forgotten its origin story. However, on Hacker News earlier today, Ferreiro revealed that he might have been drawn into the project by the unique qualities of the Unicode Braille system.

“Turns out each Braille symbol fits within a 2x4 grid of points. That's 2 possible states (point is on or off) for each of those 8 points. So 2^8 = 256 possible values. That's a byte!” enthused Ferreiro. “And luckily, Unicode encodes all those 256 possible values, and maps them to codepoints in a very systematic way.” The Snake game fitted well with the underlying animation possibilities that the Braille system opened up.

Browsing history inflation

There’s a slightly unpleasant browser side effect to the URL Snake game ‘engine’ which is worth highlighting. If you check your browser history, even after a short gaming session, you will find it has become absolutely stuffed with URL Snake entries. I spent some time deleting the hundreds of history entries, for some reason, then noticed Chrome would allow me to remove all evidence of my URL Snake shenanigans in one shot, when the history was filtered by group. Other browsers may have similar housekeeping features.

Follow Tom's Hardware on Google News, or add us as a preferred source, to get our up-to-date news, analysis, and reviews in your feeds. Make sure to click the Follow button!

Mark Tyson
News Editor

Mark Tyson is a news editor at Tom's Hardware. He enjoys covering the full breadth of PC tech; from business and semiconductor design to products approaching the edge of reason.