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 URL: https://news.ycombinator.com/item?id=42645218
Points: 85
# Comments: 19
Accedi per aggiungere un commento
Altri post in questo gruppo
![Hackers leak cop manuals for departments after breaching major provider](https://www.cdn5.niftycent.com/a/D/m/8/9/G/a/hackers-leak-cop-manuals-for-departments-after-breaching-major-provider.webp)
Article URL: https://www.dailydot.com/debug/lexipol-data-leak-puppygirl-hacker-polycule/
Comments U
![WASM will replace containers](https://www.cdn5.niftycent.com/a/D/Z/3/r/q/b/wasm-will-replace-containers.webp)
Article URL: https://creston.blog/wasm-will-replace-containers/
![Implementing the President's "DOGE" Workforce Optimization Initiative](https://www.cdn5.niftycent.com/a/k/z/7/M/B/G/implementing-the-president-s-doge-workforce-optimization-initiative.webp)
Article URL: https://www.whiteh
![Postmortem: The singular design of Namco's Katamari Damacy (2004)](https://www.cdn5.niftycent.com/a/D/2/o/n/P/K/postmortem-the-singular-design-of-namco-s-katamari-damacy-2004.webp)