3 ms·
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
by beefburger 2y ago
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.
- yodsanklai 2y agoCool! I didn't know that postscript supported interactive content. I thought the code would be generating the document and that's it.
- hamburglar 2y agoWell, 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.
- cenamus 2y agoPS was actually used for OS graphics multiple times (with more adaptions of course) https://en.m.wikipedia.org/wiki/Display_PostScript https://en.m.wikipedia.org/wiki/Display_PostScript
- hamburglar 2y agoYes but using raw postscript in this perverse way to get interactivity is truly inspired. My hat is off to the author.
- pjmlp 2y agoNot really, that is exactly how it was used in Sun NeWS. https://en.m.wikipedia.org/wiki/NeWS https://en.m.wikipedia.org/wiki/NeWS You would write full blown GUI apps in Postscript with some C glue.