Project #3: Mad Lisp

Talking with Phil got me thinking about the power of ideas, and also about programming, something I used to do with Phil a long time ago. After a year as a computer science major at UT, I decided coding was not something I wanted to spend the rest of my life doing, and switched to RTF. But I've been missing it lately and wanting to start it up again. So I decided I would attempt to program an application that could become dysfunctional if it started to listen to the data it was manipulating rather than the user. I chose to program in Common Lisp, partly because Scheme, a variation of Common Lisp, was the last high level language I worked with, partly because I had been talking to Phil about it, and partly because I knew it was especially capable at what I needed: artificial intelligence. Of course it turns out I wasn't going to be able to learn Lisp well enough in three weeks to use this capability, and the lack of available Lisp resources ending up holding back the project. But learning about Lisp and the programming language discourse in general was the best part about the project. For more on this, check the reference links.

The program I ended up with has two parts. One is an editor that goes through a text file, sentence by sentence, and allows the user to substitute words in the text file for their grammatical types (noun, adjective, ect.). The .libs file it generates can then be read in the second part à la MadLibs. The "crazy" part is that the editor part of the program saves every sentence in the text files it reads in a database. It keeps track of the number of times it has seen a given sentence, and after three viewings, that sentence may be randomly inserted into the .libs file it generates. If it has seen a sentence 10 or more times, the sentence will be output in all caps, and the punctuation mark will turn into an exclamation point.

Granted, this isn't all that thrilling. Whatever fun there may be in pen and paper MadLibs (little), it is totally absent in computer variations of the game. And the job of the editor could be more easily accomplished with any basic text editor. But this was about the best text manipulation application I could figure out how to program in the little time I had. Building the "crazyness" into a text editor or even a web browser would make things more interesting. Also, the "crazy" algorithm has problems. Saving every single sentence it reads makes the program run slowly once it has seen just a few long-ish files. Plus, having every sentence doesn't do much good. Sentences are rarely repeated exactly. To really have the program go nuts, it has to read the same file over and over. Ideally, the program would be able to recognize similar rhetoric rather than exact sentence matches. One other problem is that it doesn't have a good method for dealing with whitespace. As it stands, the program saves whitespace characters as part of a sentence and outputs them as such. This causes problems when a sentence has a return before it and is then output in the middle of a paragraph. There are some similar issues with punctuation (sentences are separated by periods, question marks, and exclamation points, so quotation marks and parentheses can cause trouble.)

Reference Material

(home) (two-liter-twister) (phil)