Exercise C: Variation Machine

In this exercise, we will utilize the various string and array tools we've learned about to create three dynamic variations on a sentence.

Steps

  1. To begin, let's step back from code and think about how variations can be formed. Read an excerpt from Exercises in Style by the Oulipo novelist, poet, and critic Raymond Queneau. PDF Link.
  2. Next, download the exercise template and add it to your project folder that we've kept in sync with github.
  3. Look at the index.js file for the three variation javascript functions. Preform your work within those functions on the newSentence variable that is outputted to the page. See the variationExample function for a guide on how to get started.

    A few ideas to get you thinking:
    • Swap the gender of third person pronouns with replace().
    • Change letter case, punctuation, or order of words.. toUpperCase(), toLowerCase(), and slice()
    • Work with the sentence as an array. Convert to array with split() and recombine to a string with join()
    • You can use objects to create a key -> value relationship between words. Here's an example.
    • You don't have to limit yourself to the words in the sentence itself. Think about the style of the sentence... bold, italics, and other ways of demarcating text.

    Email me or seek out a tutor if there's something you want to achieve but can't seem to find the right method.
  4. When you are done, add your project to your github (git slides for refresher) and then email the url to me (beasleym@newschool.edu). Submit your variation machine no later than Thursday, April 2nd by 8pm.

Resources


Next class we'll try out the variation machines you've created by inputting new sentences and discussing your process.