xxxxxxxxxx
291
// function setup() {
// createCanvas(400 400);
// }
// function draw() {
// background(220);
// }
// 0010100 = 001vowel 0100consonant
// function preload() {
// //my table is comma separated value "csv"
// //and has a header specifying the columns labels
// table = loadTable("Copy of 1st data - Sheet1.csv", "csv");
// //the file can be remote
// //table = loadTable("http://p5js.org/reference/assets/mammals.csv",
// // "csv", "header");
// }
//.getNum(i, "foo")
//traverse this arr array for each entry, and for each entry take left 4
let arr = [
"0000000",
"0000000",
"0000000",
"0000000",
"0000000",
"0000001",
"0000001",
"0000001",
"0000100",
"0000100",
"0000100",
"0000100",
"0000100",
"0000100",
"0000101",
"0000101",
"0000101",
"0001000",
"0001000",
"0001000",
"0001001",
"0001001",
"0001100",
"0001100",
"0001100",
"0001101",
"0001101",
"0010000",
"0010000",
"0010001",
"0010100",
"0010101",
"0011000",
"0011001",
"0011100",
"0011101",
"0100010",
"0100011",
"0100011",
"0100011",
"0100011",
"0100011",
"0100011",
"0100011",
"0100011",
"0100011",
"0100011",
"0100011",
"0100011",
"0100011",
"0100011",
"0100110",
"0100111",
"0100111",
"0100111",
"0100111",
"0100111",
"0100111",
"0100111",
"0100111",
"0100111",
"0100111",
"0100111",
"0100111",
"0100111",
"0101010",
"0101011",
"0101011",
"0101011",
"0101011",
"0101011",
"0101011",
"0101011",
"0101011",
"0101011",
"0101011",
"0101110",
"0101111",
"0101111",
"0101111",
"0101111",
"0101111",
"0101111",
"0101111",
"0101111",
"0110010",
"0110011",
"0110011",
"0110011",
"0110011",
"0110011",
"0110011",
"0110110",
"0110111",
"0110111",
"0110111",
"0110111",
"0110111",
"0111011",
"0111011",
"0111011",
"0111011",
"0111110",
"0111111",
"0111111",
];
let i=0;
let j=0;
let firstsyllable=[];
let secondsyllable=[];
arr.forEach(function (arr) {
var string = arr;
var a = string.substring(0, 3);
var b = string.substring(2, 6);
// console.log(a, b);
let v = "a";
let c = "b";
if (a == "000") {
v = "a";
} else if (a == "001") {
v = "e";
} else if (a == "010") {
v = "i";
} else if (a == "011") {
v = "o";
} else if (a == "100") {
v = "u";
}
if (b == "0000") {
c = "B";
} else if (b == "0001") {
c = "D";
} else if (b == "0010") {
c = "F";
} else if (b == "0011") {
c = "H";
} else if (b == "0100") {
c = "K";
} else if (b == "0101") {
c = "L";
} else if (b == "0110") {
c = "M";
} else if (b == "0111") {
c = "N";
} else if (b == "1000") {
c = "P";
} else if (b == "1001") {
c = "R";
} else if (b == "1010") {
c = "S";
} else if (b == "1011") {
c = "B";
} else if (b == "1100") {
c = "D";
} else if (b == "1101") {
c = "H";
} else if (b == "1110") {
c = "S";
} else if (b == "1111") {
c = "R";
}
firstsyllable[i]=c+v;
i++;
console.log(c,v);
});
arr.forEach(function (arr) {
var string = arr;
var a = string.substring(0, 3);
var b = string.substring(2, 6);
let v2 = "a";
let c2 = "b";
if (a == "000") {
v2 = "a";
} else if (a == "001") {
v2 = "e";
} else if (a == "010") {
v2 = "i";
} else if (a == "011") {
v2 = "o";
} else if (a == "100") {
v2 = "u";
}
if (b == "0000") {
c2 = "B";
} else if (b == "0001") {
c2 = "D";
} else if (b == "0010") {
c2 = "F";
} else if (b == "0011") {
c2 = "H";
} else if (b == "0100") {
c2 = "K";
} else if (b == "0101") {
c2 = "L";
} else if (b == "0110") {
c2 = "M";
} else if (b == "0111") {
c2 = "N";
} else if (b == "1000") {
c2 = "P";
} else if (b == "1001") {
c2 = "R";
} else if (b == "1010") {
c2 = "S";
} else if (b == "1011") {
c2 = "B";
} else if (b == "1100") {
c2 = "D";
} else if (b == "1101") {
c2 = "H";
} else if (b == "1110") {
c2 = "S";
} else if (b == "1111") {
c2 = "R";
}
secondsyllable[j]=c2+v2;
j++;
console.log(c2,v2);
});
/* Random Poetry*/
let verbs = ["smell", "watch", "bite", "attack"];
let nouns = ["birds", "humans", "bunnies", "sharks"];
let description = " ";
function setup() {
createCanvas(400, 400);
background(0);
fill(30, 105, 200);
textSize(40);
textAlign(CENTER, CENTER);
description = description + random(nouns);
description = description + " ";
description = description + random(verbs);
description = description + " ";
description = description + random(firstsyllable);
description = description + random(secondsyllable);
description = description + " ";
text(description, 0, -90, width, height);
description = description + random(nouns);
description = description + " ";
description = description + random(verbs);
description = description + " ";
description = description + random(firstsyllable);
description = description + random(secondsyllable);
description = description + " ";
text(description, 0, 0, width, height);
description = description + random(nouns);
description = description + " ";
description = description + random(verbs);
description = description + " ";
description = description + random(firstsyllable);
description = description + random(secondsyllable);
text(description, 0, 40, width, height);
}
function draw() {
}