arialy-book

I wanted to make some fun random milkshake ingredients with a hint of nonsensical evil. At first I was going to just have normal ingredients mixed with things like “1 cup from the blood of your enemies.” After finding milkshake recipes that actually had instructions, I decided to have actual recipes with unnecessarily emotional directions. After running the code, I found that some of the directions read more sweet (since many of the hate letters were love hate letters). The contrast of either love or hate with the cooking instructions was an entertaining idea to me.

I generated my book using Processing code. The milkshake names are randomly generated from a list of negative adjectives. The ingredients are random milkshake ingredients, and the directions are a markov chain from the Rita library combining hate letters from the internet and milkshake recipes. The book definitely would’ve benefitted from some sort of images, perhaps just images from #milkshake from instagram. There was also an extreme lack of coherence. Perhaps if I’d had more recipes and hate letters I would’ve been able to tweak the markov chain to make more grammatically-correct sentences (that still had the strange mix of recipe + hate letters). The ingredients also could’ve been more entertaining with a couple strange ingredients added. I’m having a hard time accessing the end result of my book, since nothing seems very funny after reading several iterations of the code.

img_1434 img_1436

arialybookgif

Cover PDF:

aricover

Contents PDF:

arialybook

Cover Code:

import processing.pdf.*;
PImage img;
ArrayList points = new ArrayList();
int index = 0;
float[] milkshake = {104.0, 364.0, 98.0, 367.0, 90.0, 372.0, 82.0, 377.0, 78.0, 381.0, 74.0, 386.0, 74.0, 393.0, 74.0, 398.0, 78.0, 405.0, 88.0, 410.0, 98.0, 415.0, 104.0, 416.0, 113.0, 417.0, 122.0, 418.0, 131.0, 418.0, 141.0, 418.0, 148.0, 418.0, 156.0, 417.0, 163.0, 416.0, 174.0, 414.0, 185.0, 408.0, 191.0, 404.0, 197.0, 399.0, 199.0, 394.0, 198.0, 389.0, 196.0, 383.0, 182.0, 374.0, 168.0, 371.0, 165.0, 364.0, 168.0, 352.0, 202.0, 167.0, 204.0, 162.0, 203.0, 134.0, 202.0, 125.0, 76.0, 125.0, 201.0, 123.0, 198.0, 117.0, 196.0, 109.0, 188.0, 101.0, 183.0, 102.0, 177.0, 95.0, 175.0, 88.0, 176.0, 94.0, 180.0, 61.0, 180.0, 57.0, 177.0, 52.0, 147.0, 12.0, 144.0, 10.0, 139.0, 12.0, 139.0, 18.0, 171.0, 60.0, 168.0, 61.0, 168.0, 65.0, 168.0, 81.0, 165.0, 82.0, 160.0, 81.0, 160.0, 85.0, 156.0, 83.0, 144.0, 82.0, 136.0, 81.0, 136.0, 82.0, 140.0, 81.0, 139.0, 71.0, 136.0, 64.0, 130.0, 62.0, 123.0, 63.0, 127.0, 62.0, 129.0, 54.0, 126.0, 56.0, 123.0, 60.0, 123.0, 55.0, 118.0, 50.0, 117.0, 57.0, 107.0, 43.0, 107.0, 47.0, 116.0, 55.0, 113.0, 57.0, 108.0, 53.0, 106.0, 53.0, 108.0, 61.0, 101.0, 55.0, 102.0, 59.0, 98.0, 65.0, 107.0, 66.0, 104.0, 66.0, 102.0, 72.0, 100.0, 79.0, 105.0, 87.0, 96.0, 91.0, 86.0, 102.0, 85.0, 105.0, 84.0, 111.0, 81.0, 112.0, 76.0, 112.0, 75.0, 118.0, 74.0, 124.0, 69.0, 125.0, 70.0, 163.0, 103.0, 352.0, 108.0, 355.0, 105.0, 364.0};

PShape s;
PFont font;

void setup() {
  beginRecord(PDF, "everything.pdf");
  size(1000, 500);
  
  font = createFont("RalewayThin.ttf", 30);
  textFont(font);
  background(0);
  
  s = createShape();
  s.beginShape();
  for (int i = 2; i < milkshake.length; i+=2) {
    s.vertex(milkshake[i-2] + 510, (milkshake[i-1]+20));}
  

  s.endShape(CLOSE);
  shape(s, 0, 0);
  text("Emotional Shakes", 720, 300);
   endRecord();
  //exit();
}


void draw() {
  
}
void mousePressed() {
 
}

Contents Code:

import processing.pdf.*;
import rita.*;
RiLexicon lex = new RiLexicon();
PFont font;
int count = 0;

RiMarkov markov;
String line = " ";
String[] files = { "../data/cAH.txt", "../data/recipes.txt", "../data/hateLetters.txt", 
  "../data/moreMilkshakes.txt", "../data/bakingBook.txt"};
String[] ingList = {"1 large or 2 small bananas", 
  "vanilla ice cream", 
  "milk", 
  "sugar", 
  "2 1/2 cups frozen blueberries", 
  "1 1/4 cups apple juice", 
  "1 cup vanilla frozen yogurt", 
  "1/4 cup skim milk", 
  "3/4 teaspoon ground cinnamon", 
  "4 scoops vanilla ice cream or frozen yogurt", 
  "3/4 cup cold milk", 
  "1/4 cup chocolate syrup", 
  "3 maraschino cherries, stems removed", 
  "whipped topping & additional cherry", 
  "1/4 cup milk", 
  "2 scoops vanilla ice cream", 
  "1 tablespoon chocolate syrup", 
  "2 tablespoons peanut butter", 
  "3 cups vanilla ice cream", 
  "1 cup chocolate milk", 
  "3 heaping tablespoons chocolate powder", 
  "2 medium sized chocolates", 
  "3 scoops vanilla ice cream", 
  "2 tablespoons chocolate chips", 
  "1/2 banana", 
  "1 tablespoon instant coffee", 
  "2 tablespoon chocolate syrup", 
  "1 cup milk", 
  "1 teaspoon vanilla", 
  "1 cup milk", 
  "1 pkg. (4-serving size) Jello, any flavor", 
  "1 pint vanilla ice cream, softened", 
  "2 cups (480ml) vanilla ice cream", 
  "1 cup (240ml) whole milk", 
  "1/4 cup (60ml) half & half", 
  "2 1/2 tablespoons (35g) sugar", 
  "1/8 teaspoon vanilla extract", 
  "4 scoops vanilla ice cream", 
  "1 cup peaches, peeled, pitted, cut up into chunks", 
  "1 cup cold orange juice", 
  "2 strawberries (garnish)", 
  "1/4 cup milk", 
  "1 scoop lime sherbet", 
  "1 scoop vanilla ice cream", 
  "handful of ice cubes", 
  "1 cup milk", 
  "2 teaspoons vanilla syrup", 
  "1 teaspoon malted milk powder", 
  "2 scoops vanilla ice cream", 
  "1 cup chocolate or vanilla ice cream", 
  "1/2 cup whole milk", 
  "3 - 4 tablespoons chocolate syrup", 
  "1 cup milk", 
  "2 scoops of your favorite ice cream", 
  "2 tablespoons instantmalted milk powder", 
  "8 ounces chai concentrate", 
  "14 ounces vanilla ice cream", 
  "vanilla ice cream", 
  "milk", 
  "about 6-8 Oreo cookies", 
  "4 oz. canned pumpkin, chilled", 
  "1-1/2 cups cold low fat milk", 
  "8 teaspoons sugar", 
  "1/8 teaspoon cinnamon", 
  "1 teaspoon vanilla", 
  "1/3 cup frozen grape juice concentrate, thawed", 
  "1 banana, peeled and sliced", 
  "1 cup milk", 
  "1/2 cup ice cubes", 
  "1 cup milk", 
  "2 scoops vanilla ice cream", 
  "4 large fresh strawberries (or 1/2 cup frozen strawberries)", 
  "1 large banana, chopped", 
  "5 cups chocolate or vanilla ice cream", 
  "2 1/2 cup milk", 
  "1 1/4 cup canned unsweetened coconut milk", 
  "1 large pineapple, peeled, cored, chopped", 
  "5 ripe bananas, peeled", 
  "3 medium papayas, peeled, seeded, chopped", 
  "32 strawberries, hulled", 
  "1/2 cup milk", 
  "1/2 cup whipped cream", 
  "2 tablespoons cherry juice", 
  "1/2 cup ice", 
  "2 - 3 scoops vanilla ice cream or frozen yogurt", 
  "1/3 cup cold milk", 
  "3 tablespoons chocolate malt syrup", 
  "whipped cream topping"};


int x = 160, y = 240;
int ingIndex0 = int(random(0, 87));
int ingIndex1 = int(random(0, 87));
int ingIndex2 = int(random(0, 87));
int ingIndex3 = int(random(0, 87));
String hateAdj = "";
String[] hateWords;
int offset = 40;


void setup()
{
  
  font = createFont("CrimsonText-Roman.ttf", 16);
  textFont(font);
  hateWords = loadStrings("hateWords.txt");
  hateAdj = hateWords[int((random(0, 526)))];
  size(500, 500, PDF, "arialyBook.pdf");

  fill(0);
  //textFont(createFont("times", 16));

  // create a markov model w' n=3 from the files
  markov = new RiMarkov(2);
  markov.loadFrom(files, this);
}

void draw()
{ 
  PGraphicsPDF pdf = (PGraphicsPDF) g;  // Get the renderer
  
  background(250);
  text(hateAdj + "Shake", 50, 30 + offset);
  text("Ingredients", 50, 80 + offset);
  text(ingList[ingIndex0], 60, 105 + offset);
  text(ingList[ingIndex1], 60, 130 + offset);
  text(ingList[ingIndex2], 60, 155 + offset);
  text(ingList[ingIndex3], 60, 180 + offset);
  text("Directions", 50, 215 + offset);
  text(line, x+10, y+175 + offset, 400, 400);
  
  hateAdj = hateWords[int((random(0, 526)))];
  ingIndex0 = int(random(0, 87));
  ingIndex1 = int(random(0, 87));
  ingIndex2 = int(random(0, 87));
  ingIndex3 = int(random(0, 87));
  if (!markov.ready()) return;

  x = y = 50;
  String[] lines = markov.generateSentences(3);
  line = RiTa.join(lines, " ");
  if (count == 0) {
    background(255);
    textAlign(CENTER);
    text("the intersections of milkshakes and hate letters", 250, 250);
    textAlign(LEFT);
}
  if (frameCount == 42) {
    exit();
  } else {
    pdf.nextPage();  // Tell it to go to the next page 
  }
  count += 1;
}

void mouseClicked(){
  
  
}