Coder shrinks classic Snake game down to a 56-byte QR code

zohaibahd

Posts: 976   +19
Staff
What just happened? The iconic Snake game that had players frantically guiding a pixelated serpent around tiny Nokia screens has received a ridiculously compact remake. Developer donno2048 has managed to compress the classic down to a mere 56 bytes – small enough to be encoded into a single QR code.

The Snake remake, designed for MS-DOS, has a size that makes it one of the tiniest functional games ever coded.

To put it into perspective, a "Hello World" program built with modern compilers falls within a few kilobytes range, with a very basic compiled executable often being roughly 10 kilobytes. Even the original 8-bit Pac-Man from 1980 was an absolute behemoth in comparison, weighing in around 12 kilobytes.

Squeezing Snake into just 56 bytes required some sacrifices. The port has a quirky glitch where inputting reverse directions once the snake reaches a length of three segments causes it to eat itself – though Snake pros might even take this as a challenge.

There are also some compatibility hurdles. The game works just fine on DOSBox and a web-based emulator, but it runs too fast on original hardware. Adjustments such as slowing down the execution are necessary to make it playable on vintage systems, though these adjustments push the size beyond 56 bytes. Still, even with the snags, this implementation is likely the smallest of its kind.

The QR snake game trend first started with MattKC's 2020 experiment, which actually inspired this new 56-byte implementation. MattKC's project utilized advanced compression techniques and tools like Crinkler to shrink a Windows executable written in C. It resulted in a much larger, 2,953-byte QR code. Subsequent efforts by different developers shrunk it further before donno2048 brought the size down to 85 bytes in 2023.

However, donno2048's second implementation has shrunk that further to just 56 bytes, beating his own previous achievement and setting quite possibly a new world record. Just look at how the QR code has become smaller over the years!

For those eager to try the tiny Snake game, an online demo is available. You control the hungry serpent using your arrow keys on PC or with swipes on mobile.

Permalink to story:

 
Man. I've been for a while now making an emulator of the first minicomputers designed and built in my country in the early 1970s, as part of a historical research (maybe I'll try to make some replicas). This past week I made a compiler for its assembler, after suffering for a while writing examples in machine code. Yesterday I completed the string/buffer support and was starting to design a simple tictactoe game. But instead I'm going to look at this, and try to port it, to play it on the simulated video terminals that I've also been making as part of the historical research and recovery project.
 
Back