Assignment 4 – Daniel Basurto

concept

The inspiration for this project came from this Friday’s rooftop-rhythms, as seeing the poems and poets gave me the idea of generating ones based on some of the most common words of the english language. I wanted to make them funny, however as you’ll soon see, that did not work out.

code

The code was a bit difficult to get, but I managed to make it so that every time you click the screen it will refresh and generate a new one.

The code ended up looking like this:

// I made a haiku generator (though they don't make much sense). I set the variables based on the structure: I [verb] a [adjective] [noun]
//         And I [verb] a [adjective] [noun] too
//         I feel like a [noun]
// While it does follow the rhytmic stucture of a Haiku, it is neither deep/thought-provoking or artistic

let NOUN1 = 0;
let VERB1 = 1;
let ADJ1 = 2;
let NOUN2 = 3;
let VERB2 = 4;
let ADJ2 = 5;
let NOUN3 = 6;

let strings = [];

function setup() {
  strings = loadStrings("words.csv");
  createCanvas(400, 400);
  background(
    random(150, 255),
    random(150, 255),
    random(150, 255),
    random(50, 100)
  );
  textSize(20);
  for (let i = 0; i < 200; i++) {
    push();
    noStroke();
    fill(255, 255, 255);
    ellipse(random(0, width), random(0, height / 2 - 40), random(2, 5));

    pop();
  }
}

let csvRowNumber = 0;

function draw() {
  let singleRow = [];
  fill(0);
  // First message/rhyme
  singleRow = split(strings[int(random(strings.length))], ",");
  let verb1 = singleRow[VERB1];
  singleRow = split(strings[int(random(strings.length))], ",");
  let adj1 = singleRow[ADJ1];
  singleRow = split(strings[int(random(strings.length))], ",");
  let noun1 = singleRow[NOUN1];
  text("I " + verb1 + " a " + adj1 + " " + noun1, 0, height / 2);

  // Second message//
  message = "And I ";
  singleRow = split(strings[int(random(strings.length))], ",");
  message += singleRow[VERB2];
  message += " a ";
  singleRow = split(strings[int(random(strings.length))], ",");
  message += singleRow[ADJ2];
  message += " ";
  singleRow = split(strings[int(random(strings.length))], ",");
  message += singleRow[NOUN2];
  message += " too";
  text(message, 0, height / 2 + 25);

  //Third message//
  singleRow = split(strings[int(random(strings.length))], ",");
  let noun3 = singleRow[NOUN3];
  text("I feel like a " + noun3, 0, height / 2 + 50);

  noLoop();
}

function mouseClicked() {
  background(random(150, 255), random(150, 255), random(150, 255)); //refreshes the background
  for (let i = 0; i < 200; i++) {
    push();
    noStroke();
    fill(255, 255, 255);
    ellipse(random(0, width), random(0, height / 2 - 40), random(2, 5));
  }
  loop();
}

EMBEDDED code

future IMPROVEMENTS

Personally, I wish I could have made the backgrounds have a color gradient to make it look prettier. However, it will be something I’d have to learn.

Another area for improvement would be the haikus themselves, since they are usually senseless, I’d like to make them more concrete.

One thought on “Assignment 4 – Daniel Basurto”

Leave a Reply