2021
2021 copied to clipboard
Some ludicrously short novel generators
This is a response to #69. An issue title like that sounds like a challenge, you know. A claim that deserves investigation, at least.
I would like to present for your entertainment a number of novel generators which are very short indeed.
Generator the First
To begin, here is a program written in the language HQ9+. It outputs the full lyrics to the rousing counting song "99 Bottles of Beer on the Wall", twenty-three times:
99999999999999999999999
Since this song has 25 words per verse, and 99 verses, and is output 23 times, a simple multiplication tells us that this program outputs 54648 words, which, in NaNoGenMo, is a novel. Here's a preview:
99 bottles of beer on the wall, 99 bottles of
(Alas, I can't bring myself to continue writing that out, much less post the entire thing. I suppose I will simply forego the 'completed' label on this one.)
You'll note that the program is only 23 characters long. Further, in the quite well-established ASCII encoding, the character 9 only occupies one byte, so this program can be expressed in only 23 bytes, as well.
Generator the Second
Though not as old as ASCII, HQ9+ is fairly well established as well -- it's 20 years old this year. However, if we are permitted to, as Lyxal has, make up a new language, I'm sure we can do better than 23 characters.
So, allow me to define the language HQ9N̅+. This is a variation on HQ9+ which enhances it in two small ways. First, it adds another instruction:
- N: output 50,000 copies of the word "meow", separated by whitespace
Which means the following HQ9N̅+ program is a novel generator:
N
despite the fact that it's only 1 character long. Here's a preview: meow meow meow but again I will forego posting the entire output.
Generator the Third
But wait! Not done yet! The second enhancement to HQ9+, to which the overbar on the N in "HQ9N̅+" is clumsily alluding, is this rule:
- A HQ9N̅+ program must have at least one instruction. If the HQ9N̅+ interpreter cannot find any instructions in the program, it supplies an N instruction as the default, and executes it.
Which gives us the following novel generator
of length zero.
I hope you enjoyed this little demonstration. We now return you to your regular computer-aided Oulipo jam, already in progress.
Lanmonster fixed the Q instruction and added the + instruction. Qh4os fixed the 9 instruction. Chris Pressey also fixed the 9 instruction.
https://esolangs.org/wiki/HQ9%2B
I particularly like that you fixed a 20-year-old language in preparation of this demo!