/* Ivanrey Barlongo 5/14/14 Here is a way to randomly generate "How to" thoughts by using arrays. "How to" Generator */ //*************VARIABLES***************// //These are some "How to" problems String phrase[] = { "Earn Respect", "Get Ahead in Life", "Cut a Shirt", "Make Spinach Pie", "Take Action to Reduce Air Pollution", "Indirectly Flirt", "Eat Dry Ice", "Sit Correctly on a Wall", "Freeze an Ice Cube", "Grow Parsley", "Walk in a Sexy Way", "Drink a Water Bottle in 3 Seconds", "Not Lose Chap Sticks Before Using It All", "Say Hello", "Indirectly Be Evil", "Have Multiple Personalities", "Become a Loner", "Have the answers to all questions", "Play an indirect prank on the innocent", "Get out of doing chores in order to do homework", "Eat raw food", "Drink your own urine", "Get a bug to fly into you", "Make Strawberry Smoothies", "Lift one pound" //There are a total of 25 "How to" in this String //Note: One string is only capable of holding 25 }; PFont f; int phr = int(random(phrase.length)); //This generates a random position in String phrase[] //***********RUN PROGRAM****************// void setup(){ size(400,200); f = createFont("Harrington",16,true); fill(#000000); /*****************PRINTS IN CONSOLE*****************/ phraseOne(); phraseTwo(); phraseThree(); phraseFour(); phraseFive(); phraseSix(); phraseSeven(); phraseEight(); phraseNine(); phraseTen(); phraseEleven(); phraseTwelve(); phraseThirteen(); phraseFourteen(); phraseFifteen(); phraseSixteen(); phraseSeventeen(); phraseEighteen(); phraseNineteen(); phraseTwenty(); phraseTwentyone(); phraseTwentytwo(); phraseTwentythree(); phraseTwentyfour(); phraseTwentyfive(); } //******************FUNCTIONS**********// // These functions tell what to print from the // given random position void phraseOne(){ if (phr == 0){ println("How to "+"Earn Respect?"); }; } void phraseTwo(){ if (phr == 1){ println("How to "+"Get Ahead in Life?"); }; } void phraseThree(){ if (phr == 2){ println("How to "+"Cut a Shirt?"); }; } void phraseFour(){ if (phr == 3){ println("How to "+"Make Spinach Pie?"); }; } void phraseFive(){ if (phr == 4){ println("How to "+"Take Action to Reduce Air Pollution?"); }; } void phraseSix(){ if (phr == 5){ println("How to "+"Indirectly Flirt?"); }; } void phraseSeven(){ if (phr == 6){ println("How to "+"Eat Dry Ice?"); }; } void phraseEight(){ if (phr == 7){ println("How to "+"Sit Correctly on a Wall?"); }; } void phraseNine(){ if (phr == 8){ println("How to "+"Freeze an Ice Cube?"); }; } void phraseTen(){ if (phr == 9){ println("How to "+"Grow Parsley?"); }; } void phraseEleven(){ if (phr == 10){ println("How to "+"Walk in a Sexy Way?"); }; } void phraseTwelve(){ if (phr == 11){ println("How to "+"Drink a Water Bottle in 3 Seconds?"); }; } void phraseThirteen(){ if (phr == 12){ println("How to "+"Not Lose Chap Sticks Before Using It All?"); }; } void phraseFourteen(){ if (phr == 13){ println("How to "+"Say Hello?"); }; } void phraseFifteen(){ if (phr == 14){ println("How to "+"Indirectly Be Evil?"); }; } void phraseSixteen(){ if (phr == 15){ println("How to "+"Have Multiple Personalities?"); }; } void phraseSeventeen(){ if (phr == 16){ println("How to "+"Become a Loner?"); }; } void phraseEighteen(){ if (phr == 17){ println("How to "+"Have the answers to all questions?"); }; } void phraseNineteen(){ if (phr == 18){ println("How to "+"Play an indirect prank on the innocent?"); }; } void phraseTwenty(){ if (phr == 19){ println("How to "+"Get out of doing chores in order to do homework?"); }; } void phraseTwentyone(){ if (phr == 20){ println("How to "+"Eat raw food?"); }; } void phraseTwentytwo(){ if (phr == 21){ println("How to "+"Drink your own urine?"); }; } void phraseTwentythree(){ if (phr == 22){ println("How to "+"Get a bug to fly into you?"); }; } void phraseTwentyfour(){ if (phr == 23){ println("How to "+"Make Strawberry Smoothies?"); }; } void phraseTwentyfive(){ if (phr == 24){ println("How to "+"Lift one pound?"); }; } //End of Functions /*****************************PRINTS ON SCREEN****************************/ void draw() { background(255); textFont(f,16); if (phr == 0){ text("How to "+"Earn Respect?",10,100); }; if (phr == 1){ text("How to "+"Get Ahead in Life?",10,100); }; if (phr == 2){ text("How to "+"Cut a Shirt?",10,100); }; if (phr == 3){ text("How to "+"Make Spinach Pie?",10,100); }; if (phr == 4){ text("How to "+"Take Action to Reduce Air Pollution?",10,100); }; if (phr == 5){ text("How to "+"Indirectly Flirt?",10,100); }; if (phr == 6){ text("How to "+"Eat Dry Ice?",10,100); }; if (phr == 7){ text("How to "+"Sit Correctly on a Wall?",10,100); }; if (phr == 8){ text("How to "+"Freeze an Ice Cube?",10,100); }; if (phr == 9){ text("How to "+"Grow Parsley?",10,100); }; if (phr == 10){ text("How to "+"Walk in a Sexy Way?",10,100); }; if (phr == 11){ text("How to "+"Drink a Water Bottle in 3 Seconds?",10,100); }; if (phr == 12){ text("How to "+"Not Lose Chap Sticks Before Using It All?",10,100); }; if (phr == 13){ text("How to "+"Say Hello?",10,100); }; if (phr == 14){ text("How to "+"Indirectly Be Evil?",10,100); }; if (phr == 15){ text("How to "+"Have Multiple Personalities?",10,100); }; if (phr == 16){ text("How to "+"Become a Loner?",10,100); }; if (phr == 17){ text("How to "+"Have the answers to all questions?",10,100); }; if (phr == 18){ text("How to "+"Play an indirect prank on the innocent?",10,100); }; if (phr == 19){ text("How to "+"Get out of doing chores in order to do homework?",10,100); }; if (phr == 20){ text("How to "+"Eat raw food?",10,100); }; if (phr == 21){ text("How to "+"Drink your own urine?",10,100); if (phr == 22){ text("How to "+"Get a bug to fly into you?",10,100); }; if (phr == 23){ text("How to "+"Make Strawberry Smoothies?",10,100); }; if (phr == 24){ text("How to "+"Lift one pound?",10,100); }; } } //The end of our if statements and now close void draw(){