Tetris in PostScript

https://github.com/nst/PSTris

By beefburger at

beefburger | 1 comment | 5 days 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 | 2 comments | 7 hours ago
Cool! I didn't know that postscript supported interactive content. I thought the code would be generating the document and that's it.
cenamus | 1 comment | 2 hours ago
PS was actually used for OS graphics multiple times (with more adaptions of course)

https://en.m.wikipedia.org/wiki/Display_PostScript

hamburglar | 0 comments | 2 hours ago
Yes but using raw postscript in this perverse way to get interactivity is truly inspired. My hat is off to the author.
hamburglar | 0 comments | 3 hours ago
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.
WCSTombs | 0 comments | 53 minutes ago
This is very cool! To run this on a modern Linux, install Ghostscript and run it like this:

    gs -dNOSAFER tetris.ps
In another terminal in the same working directory, run the command it gives in the source file:

    stty raw -echo; cat >> t.txt
Keep the second terminal focused for your keyboard inputs. I don't know if there's an elegant way to quit, but I just close the Ghostscript window and kill the second terminal.
cafeinux | 1 comment | 3 hours ago
In two weeks we'll see "Doom in PostScript" pop on the homepage.
kristianp | 0 comments | 2 hours ago
Is there a C to PS transpiler?
zzmmm | 0 comments | 5 hours ago
Anyone remember NeWS - Network extensible Window System? It was built in Postscript.

http://dev.rsnous.com/dewdrop/executive/

bobajeff | 0 comments | 5 hours ago
This is pretty neet. Tried running it with ghostscript under Linux and it crashes pretty much after the first tetromino falls a square.
codr7 | 0 comments | 8 hours ago
It's actually a pretty cool language, a forthy lisp/lispy forth.