MASHing with CFG

This week, we were shown how to use Tracery to create Context Free Grammar (CFG) outputs. Because of things like article agreement, CFG can be a bit tricky, but, fortunately, Tracery exists to help with stuff like that. For my project, I wanted to create something fun and interactive. This week ended up taking back to the schoolyard; I would say “hello 1980s”, but I have a feeling this game was going on well before I was in elementary school and is probably still in the minds of some kids somewhere hoping to get back to the schoolyard.

Because this game requires input, I pulled on a Mad Libs coding project I did last Spring to get an idea of how the code should look. From there, I experimented to see if variables could go into the dictionary definition for the story. After playing around with the code for a bit, I was able to get the story compiled and computed, so everyone can get a better glimpse of their future.

[I had originally embedded the sketch here, but the sketch’s pop-up boxes would appear when the blog post loaded. You can check it out here.]

Here’s a direct link to my sketch MASHing with CFG’s code, if you’re curious to know your future.