UNIT.City — місце, де люди працюють... КРАЩЕ! Обирай свій простір просто зараз 👉
Наталя ХандусенкоGameDev Eng
14 January 2025, 16:33
2025-01-14
Developer shrinks iconic Snake game to 56-byte QR code
The legendary Snake game, in which players controlled a pixelated snake on tiny Nokia screens, has been given an incredibly compact remake. Developer donno2048 has managed to squeeze the classic game down to 56 bytes — enough to be encoded into a single QR code.
The legendary Snake game, in which players controlled a pixelated snake on tiny Nokia screens, has been given an incredibly compact remake. Developer donno2048 has managed to squeeze the classic game down to 56 bytes — enough to be encoded into a single QR code.
The remake of Snake, developed for MS-DOS, has a size that makes it one of the smallest functional games ever written.
By comparison, a Hello World program built with modern compilers is in the range of a few kilobytes in size, and the simplest compiled executable is often around 10 kilobytes. Even the original 8-bit Pac-Man from 1980 was an absolute behemoth by comparison, weighing in at around 12 kilobytes, TechSpot writes .
Squeezing Snake down to just 56 bytes required some sacrifices. The port has a strange glitch: entering reverse directions when the snake reaches three segments in length causes it to eat itself—although Snake pros might even take this as a challenge.
Source: TechSpot
There are also some compatibility issues. The game runs fine on DOSBox and the web emulator, but it runs too fast on the original hardware. Adjustments such as slowing down the execution are necessary to make it playable on older systems, although these adjustments increase the size beyond 56 bytes. However, even with the flaws, this implementation is probably the smallest of its kind.
The QR snake trend first emerged from MattKC's experiment in 2020, which actually inspired this new 56-byte implementation. MattKC's project used advanced compression techniques and tools like Crinkler to shrink a Windows executable written in C. The result was a much larger QR code, at 2,953 bytes. Subsequent efforts by various developers reduced it even further, until donno2048 reduced the size to 85 bytes in 2023.
However, in a second implementation, donno2048 reduced the code size to 56 bytes, beating his own previous achievement and setting what could very well be a new world record. You can see how the QR code has shrunk over the years in the image.
Source: TechSpot
The tiny game "Snake" is available in an online demo. The snake is controlled by the arrow keys on a PC or swipes on a mobile.