If people had the time, patience, and a lot of accuracy available to them, they would be able to build video game sprites by using nothing more than your standard “Tetris” cartridge. But since computers have been taking over the world, why bother going through all of that, when the computer can do it for you? A new program called “Tetris Printer Algorithm” can do just that.

“Tetris Printer Algorithm” was created by a man named Michael Birken, aka “Meat Fighter”. The way it works is very simple. Select the sprite image that you want to use it with, and the algorithm will use a combination of eight different colored tetrominoes, as well as combine it with the black background to create the sprite. (Video game programmers often took advantage of the background to gain an extra color, for example, Bub’s pupils and mouth from Bubble Bobble, Donkey Kong’s pupils and Ms. Pac-Man’s eyebrow and mole.) The program can accept sprite image that are no bigger that 17×32 pixels (enough for a plethora of NES sprites indeed, as most of those games packed their graphics into 8×8 tiles, with 2 bits being dedicated to each pixel.) In addition, the sprite can’t have any more than 3 opaque colors. Everything else in the sprite must be transparent.

The algorithm converts all of the pixels from the source into squares in the play field, one row at a time from the bottom up. The algorithm assembles a structure consisting of a rectangular region fully supported by a single square protruding from the bottom, to generate a single square. When the rectangular region is completed, its rows are cleared, leaving behind the protruding square. During construction of a row, all of the squares produced by this method must be supported.

Dropping a piece into the matrix will obviously involve increasing the stack heights of the associated columns. To speed up this process, all Tetriminos are analyzed ahead of time. There are 19 distinct rotations of Tetriminos, and the search treats each of them as a unique piece. The Tetris Printer Algorithm converts each row of the bitmap image in a series of passes. Moving from left to right, each pass greedily plugs in J, T and L Tetriminos whenever they fit.

This amazing feat may sound a little complicated for many, but the JavaScript programming is nothing more than pure genius. To make it simple, a video showing the product in action has been uploaded to YouTube, which will show you some amazing results from some of your favorite video game sprites.

[youtube http://www.youtube.com/watch?v=PJkHwulsac4]

“Meat Fighter’s” Tetris Printer Algorithm: http://meatfighter.com/tetrisprinteralgorithm/

Source: http://meatfighter.com/tetrisprinteralgorithm/tetris_printer_algorithm_src.zip