Playing Chess Against Your Printer, With PostScript

Can you play chess against your printer? The answer will soon be yes, and it’s thanks to [Nicolas Seriot]’s PSChess. It’s a chess engine implemented in PostScript, of all things. It’s entirely working except for one last hurdle, but more on that in a moment.

What’s it like to play PSChess? Currently, one uses a PostScript interpreter (such as GhostScript) to run it, much like one would use the Python interpreter to run Python code. The user inputs moves by typing in commands like d2d4 (representing a piece’s source coordinate and a destination coordinate on the 2D board). Then the program makes a move, and outputs an updated board state to both the console and a PDF document. Then it’s the user’s turn again, and so on until somebody loses.

The chess parts are all working, but there’s one last feature in progress. The final step of the project is to enable PSChess to be run directly on a printer instead of using GhostScript as the interpreter. Intrigued? You can find the code at the project’s GitHub repository.

So why PostScript? While it is a Turing-complete stack-based interpreted language, it was never intended to be used directly by humans. There are no meaningful development tools to speak of. Nevertheless, [Nicolas] finds PostScript an appealing tool for programming projects and provides tips and techniques for like-minded folks. One of the appeals is working within constraints to solve a problem, just like implementing a chess engine in only 4k, or draw poker in 10 lines of BASIC.

9 thoughts on “Playing Chess Against Your Printer, With PostScript

  1. Back in the 1980’s, when postscript was fresh and shiny, and I was in uni, we had a supercomputer on campus, as well as a mainframe in the computing center, and PC’s galore. Then we got a new postscript printer (large, desk-side) set up as pay-per-page. When it came time to do me thesis project, I ran out of resource on the mainframe. The PC’s were WAY too slow. The postscript printer, on the other hand, gave the supercomputer a run for it’s money, from my point of view. I tied it up all night most every night for a few weeks working on the code and running a high res FEA for dopant diffusion and annealing in silicon. Total cost was about 20 pages of results and graphs. The results were good enough to degree, but not really very good.

  2. In the eighties I used to be a developer of typesetting software so I got a prototype QMS-PS 800 laser printer from my employer. It was much more powerful than any of the computers used to send a print job. It featured a serial interface so you had a bidirectional interface to talk to the postscript interpreter.
    So me and my fellow hacker friends coded computing intensive tasks in postscript and sent them to the printer that happily sent back the results via serial. We used the printer to offload computing tasks even without blacking a single page of paper.

  3. I used the PS interpreter on a printer to design a stringer for steps I was building for my wood deck. I could enter the rise, run and number of steps and it would print a diagram of the string with dimensions so that I could cut it properly. Unfortunately I got sunburn on my back when I cut and built the steps but my printer didn’t advise me to keep my shirt on.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.