Lurker News
I realized that the PDF engines of modern desktop browsers (PDFium and PDF.js) support JavaScript with enough I/O primitives to make a basic game like Tetris.

It was a bit tricky to find a union of features that work in both engines, but in the end it turns out that showing/hiding annotation "fields" works well to make monochrome pixels, and keyboard input can be achieved by typing in a text input box.
All in all it's quite janky but a nice reminder of how general purpose PDF scripting can be. The linked PDF is all ASCII so you can just open it in a text editor, or have a look at the source code here: https://github.com/ThomasRinsma/pdftris/blob/main/gengrid.py

Comments (223) 81 threads

Earlier comments
amunozo#
Lol, I love it. Why didn't you include points multipliers when more than one line is filled though?
ReneFroger1 reply#
I'm wondering if running Doom in PDF files might be achievable, or is that a step too far away?
vanderZwan1 reply#
Probably in the domain of technically possible but good luck trying to get it to run fast enough and with little enough memory that the PDF engine doesn't crash.
kleiba#
A friend of mine once applied for a job with the local PT operator. For that, I finagled the PDF of his CV such that after a minute or so, one of the company's trains would drive over the page from left to right at the very bottom.

He never heard back from them.

theginger#
I hope to see this evolved into doom by the end of the year. And it better not be just monochrome

Load more comments