Get hip to the scene by encrypting any string as an avant-garde poem.
What is a Beatnik program?
The Beatnik programming language, written by Cliff L. Biffle (aka Cliffle) in 2001, is a syntax-free stack language that uses the Scrabble score of the tokens as op codes and parameter values. According to Cliffle’s website:
A Beatnik program consists of any sequence of English words, separated by any sort of punctuation from spaces to hyphens to blank pages. Thus, “Hello, aunts! Swim around brains!” is a valid Beatnik program, despite not making much sense.
According to Merriam-Webster, the definition of encrypt is “to change (information) from one form to another especially to hide its meaning.” Encryption plays a big role in computer science, and it is ubiquitous to technology today. While we make no claims about the overall security of hiding a message in the code of an esoteric programming language, we certainly feel it qualifies as a form of encryption (albeit weak). It also satisfied our desire to make something both practical and humorous.
Programs writing programs
One of the things that initially intrigued us about the project was the prospect of writing a program that writes a program. This, we felt, was the main “new and complex” element that was being explored. Solving the problem required us to get an understanding of how stack languages work, and that was also new territory, though not terribly complex. We also wanted to make the poems feel like poems instead of just looking like long strings of random words chained together. To that effect, we put measures in place to sprinkle whitespace and punctuation throughout based on distribution percentages.
What words are we using to generate the poems?
When the page is loaded, we make a call to RandomText.me’s gibberish API, which gives us back a string full of nonsense. We parse the words out of the nonsense, give them Scrabble scores, and attempt to add them to our own database of word/score pairs. If the word is not already in the database, it gets added. You can actually see in the browser console how many words are added each time the page is loaded. They’re added in four batches, so there are four messages in the console that read, “Learned # new words!” If this project is ever extended in the future, it would be a good idea to explore some other word-generation APIs, since RandomText.me’s API has a limited selection. The “learning” growth starts to level out between 3000 and 4000 words.