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.

After 40 Years, Adobe Releases PostScript Source V0.10 For Posterity

Celebrating their 40th anniversary, Adobe released the source code of PostScript v0.10 to the Computer History Museum. But before you ask, we tried and it won’t compile with GCC out of the box – it’s missing at least except.h, but we’d bet you can hack around it with a little dedication.

PostScript is the precursor to PDF, and at the time it was revolutionary. Coming out of Xerox’s PARC, the idea was to create device- and resolution-independent documents where all the characters, symbols, and graphics are described by their shapes instead of bitmaps. PostScript’s secret sauce was in how it went back to a pixel-based representation for end use on monitors or printers. It’s no exaggeration to say that this ended up revolutionizing the print industry, and it makes sense in the CHM’s collection.

Still, on the trade-secret front, you shouldn’t get too excited. Apparently the code released here only includes a first-draft version of Adobe’s font hinting algos, as evidenced by the early version number. Nonetheless, you’re free to dig into pretty readable C. For instance, vm.c contains the virtual machine that implements PostScript’s almost Forth-like language.

Of course, if you’d just like to mess around with PostScript, downloading a modern open-source interpreter like GhostScript probably makes a lot more sense. Even so, it’s fun to see the original codebase where it all started.

Linux Fu: PDF For Penguins

PostScript started out as a programming language for printers. While PostScript printers are still a thing, there are many other ways to send data to a printer. But PostScript also spawned the Portable Document Format or PDF and that has been crazy successful. Hardly a day goes by that you don’t see some kind of PDF document come across your computer screen. Sure, there are other competing formats but they hold a sliver of market share compared to PDF. Viewing PDFs under Linux is no problem. But what about editing them? Turns out, that’s easy, too, if you know how.

GUI Tools

You can use lots of tools to edit PDF files, but the trick is how good the results will look. Anything will work for this: LibreOffice Draw, Inkscape, or even GIMP. If all you want to do is remove something with a white box or make an annotation, these tools are usually great, but for more complicated changes, or pixel-perfect output, they may not be the right tool.

The biggest problem is that most of these tools deal with the PDF as an image or, at least, a collection of objects. For example, columns of text will probably turn into a collection of discrete lines. Changing something that causes a line to wrap will require you to change all the other lines to match. Sometimes text isn’t even text at all, but images. It largely depends on how the creator made the PDF to begin with. Continue reading “Linux Fu: PDF For Penguins”

Simple Low Toner Workaround Squeezes Out A Few Extra Pages When Your Printer Refuses


[Andrew] was getting ready to print out an assignment when his Samsung printer suddenly started blinking a red error light at him. Unable to find any documentation explaining the issue, he called Samsung directly and found that it was indicating the toner cartridge was nearly empty.

He held down the button that prints a test page, which came out just fine despite the printer’s insistence that there was not enough toner left. Annoyed at the fact that he felt Samsung was trying to strong arm him into buying another pricey toner cartridge, he looked for a way around the restriction.

He discovered that his printer’s software allowed him to specify a custom test page document, though it required that the document be in PostScript format. After a few shell commands, he had his document converted and was on to bigger and better things.

While a bit time consuming, his workaround should let him get by on this toner cartridge at least for a little while longer. We imagine that since he’s using Linux, the process could probably be scripted to save time, though we’re not sure if the same can be said for Windows-based PCs.