Michael Birken lays out, in detail, a method for teaching a computer to draw arbitrary 8-bit images by playing Tetris, strategically deploying blocks of various colors to cause exactly the picture you want to emerge. The method is (as you'd imagine), starkly terrifying in its complexity, but the video speaks for itself.
The algorithm converts pixels from a source image into squares in the Tetris playfield, one row at a time from the bottom up. To generate an individual square, the algorithm assembles a structure consisting of a rectangular region fully supported by a single square protruding from the bottom. When the rectangular region is completed, its rows are cleared, leaving behind the protruding square. Three examples of the process appear below.
The algorithm can also generate multiple squares with a single structure as shown below.
During construction of a row, all of the squares produced by this method must be supported. In the images above, the generated squares are supported by the floor of the playfield. However, if an arbitrary row contains holes, it may not provide the support necessary for the construction of the row above it. The algorithm solves this problem by constructing a flat platform on top of the row with holes. In the animation below, a platform is built above a row comprising of a single red square. The platform is a temporary structure and inserting the final piece removes it.
Tetris Printer Algorithm
(via Hacker News)
When game critic Jim Sterling uses video clips of the games he reviews on YouTube, the game companies claim copyright ownership of the video and run ads on Sterling’s reviews. He doesn’t like that because his videos are funded by Patreon and he doesn’t think his audience should have to see ads. So what he […]
Dyson Logos’s G+ account is an endlessly scrolling inventory of hand-drawn D&D maps, each one cooler than the last.
Campaigners from Liberty, a civil liberties group, took to the streets of London (and the lobby of the Home Office!) and grabbed peoples’ phones, browsing them while explaining that they just wanted to build a detailed dossier of their lives by looking at their communications, browsing history and location data — mirroring the way that […]
Isn’t it about time to stretch what your Mac can do? I mean, you’ve got plenty of great programs now…but don’t you think you could use some new tools to get your creative, analytical and organizational juices really flowing? It’s spring, so we cleaned up a whole bunch of super-cool apps lying around and packaged […]
In the world of app development, there’s no greater arena to find success than with Android users. About 80% of the smartphones in use today worldwide operate on the Android operating system, so if you build a great app that Android users love, you’re an international rock star. You’ll be able to make sure your […]
Unless you’re a programmer or webmaster, the term SQL probably doesn’t mean much to you. But for those looking to understand more about how and why the web works the way that it does, know this – SQL and its process of managing and presenting large data sets is everywhere…and it’s the most in-demand programming […]