This lesson began with a quick discussion of Mad Libs. What are Mad Libs? How do you play Mad Libs? I was surprised to find that only about 5% of my middle school students had played Mad Libs. One student explained that, in Mad Libs, you are given a short story with blanks to fill with nouns, verbs, or whatever. When you read your finished Mad Lib, you (hopefully) get a funny, random story.
As a class, we discussed JavaScript, JSON, and Kate Compton's Tracery. We went to the Tracery Tutorial on Crystal Code Palace and began to familiarize ourselves with the JSON/Tracery "rules" (aka syntax). Like Mad Libs, there was a sentence with blanks (like #color# and #animal#) to be filled with colors, animals, or whatever.
{
"sentence": ["The #color# #animal# of the #natureNoun# is called #name#"]
, "color": ["orange","blue","white","black","grey","purple","indigo","turquoise"]
, "animal": ["unicorn","raven","sparrow","scorpion","coyote","eagle","owl","lizard"]
, "natureNoun": ["ocean","mountain","forest","cloud","river","tree","sky","sea","desert"]
, "name": ["Arjun","Yuuma","Darcy","Mia","Chiaki","Izzi","Azra","Lina"]
}
We took the example above (example 2 from Crystal Code Palace) and began to personalize it. We changed the "hashtags" (aka variables) and adapted the "lists" (aka arrays). We ended up with this...
{
"sentence": ["#name#, the #adj# #animal# from #place#"]
, "adj": ["fluffy","smart","invisible"]
, "animal": ["unicorn","duck","kitten"]
, "place": ["the ocean","Cabela's","Ohio"]
, "name": ["Caleb","Rover","Cartman"]
}
On Crystal Code Palace, we could instantly see the results from our code.
The students worked individually creating their own sentences, adjectives, animals, places, and names. After school, I combined all of their JSON values (you can check it out on GitHub), created a Twitter account for our bot, and then posted the code on George Buckenham's Cheap Bots Done Quick. Soon, our Twitterbot was brainstorming book titles.
https://twitter.com/booktitlebot/status/645424665494745092
https://twitter.com/booktitlebot/status/645386928007839744
https://twitter.com/booktitlebot/status/645032078887780352
The next day, we discussed what a "bot" is, what a "Twitterbot" is, and reviewed what our Twitterbot had been tweeting overnight. A few minutes later, the students split into pairs and began working on their own Twitterbots.
Click here for the complete list of my students' Twitterbots
RECENT POSTS