Well, as I wrote in
the previous post, sed is a Turing complete language. We can use it to implement some simple algorithms, or even a dc interpreter. But what does it really mean? How complex tasks may we achieve using plain sed? What about writing some game? While browsing web, I came across a classic Tetris game written in pure sed. Save this file to something like tetris.sed. Depending on your system, you may need to adjust shebang. For example if you are using PLD Linux, change “#!/usr/bin/sed” to “#!/bin/sed”. chmod a+x it, and run it. Unfortunately main loop is controlled by input lines, so you need to press ENTER few times to allow things to happen. It seems to be the strong limitation of sed. Don’t you think it is awesome? In case you can not get it work (or you just don’t trust any piece of code that people publish on the web), there is an amazing video of tetris.sed in action: Since there is no way to display any graphics in pure sed, we are limited to rogue-like games. Now I’m waiting for ADOM being rewritten in sed!