Tetris in PostScript
9 comments
·February 19, 2025beefburger
yodsanklai
Cool! I didn't know that postscript supported interactive content. I thought the code would be generating the document and that's it.
cenamus
PS was actually used for OS graphics multiple times (with more adaptions of course)
hamburglar
Yes but using raw postscript in this perverse way to get interactivity is truly inspired. My hat is off to the author.
hamburglar
Well, it really doesn’t. This uses a clever hack where you write the input to a text file that the PS program is continuously reading. Very cool.
cafeinux
In two weeks we'll see "Doom in PostScript" pop on the homepage.
bobajeff
This is pretty neet. Tried running it with ghostscript under Linux and it crashes pretty much after the first tetromino falls a square.
zzmmm
Anyone remember NeWS - Network extensible Window System? It was built in Postscript.
codr7
It's actually a pretty cool language, a forthy lisp/lispy forth.
I've just implemented Tetris in PostScript, pushing the limits of a document-processing language to run a realtime game. It works in GhostView on macOS.
* 600 lines / 10 KB * 69 different PostScript operators, no external libs * Realtime input, direct drop, increasing speed levels * 7-tetrimino random bags * Nintendo-style scoring and high score tracking
This project builds on my earlier experiments with PSChess and PSSokoban.
It show that PostScript is a lightweight, expressive, and surprisingly interactive programming language. A perfect tool for hacking on unexpected platforms.