How often have you wished to have an instruction manual — or, at least, a Unix man page — for life? Well, your wait is over. Of course, you probably were hoping for instructions on how to navigate life, but [cve’s] mott program plays life inside a man page. That might not be as useful as a real manual for life, but it is still pretty cool.
To understand what’s happening, you have to understand how man pages work. They use an old form of markup known as roff
, which later begat nroff
and troff
. While roff
is made to do crude word processing at the dawn of Unix, it is also a Turing-complete language.
You do need groff
installed and, of course, man
. If you have all that, you can get a live demo with:
curl https://codeberg.org/cve/mott/raw/branch/main/mott.1 | man -l -
We’ll leave understanding all the macros involved as an exercise for the reader, but we are certainly impressed with the audacity of the idea and the implementation.
We would ask if it could play Doom, but we are afraid someone would answer yes and then show us. If you think markup is old-fashioned, don’t be too sure. (Although the underlying project is now at a new URL)
“While roff is made to do crude word processing at the dawn of Unix, it is also a Turing-complete language.” [emphasis added]
Note to self: Study the security implications of this, and promise to only use the knowledge obtained for good.
Doesn’t work in terminal on a Mac.
CAVEATS
At the moment, mott requires a groff(1) suite to function properly, meaning that the default man(1) utility will probably not work if you are on a BSD system, macOS or any other system using mandoc(1). Support for mandoc(1) and other, mostly legacy, roff(7) implementations is planned and largely depends on the removal of our usage of the while macros.
As seen on the grapse online man page tester (which also doesn’t work with this).