Created
February 23, 2017 00:40
-
-
Save nataliefreed/738279b68c30faf21ee45e84d2d55936 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Exercises: | |
1. Change the nouns, verbs, adverbs to your own choice of words | |
2. Change the sentence structure (for example, add "and" and then a second clause) | |
3. Change the words to a different language (could be the one you are studying in | |
school right now). Change the sentence structure so that the sentences are grammatically | |
correct. | |
*/ | |
var nouns, verbs, adverbs; | |
function setup() { | |
createCanvas(500, 500); | |
textSize(20); | |
nouns = ["cat", "dream", "computer"]; | |
verbs = ["eats", "sleeps", "paints"]; | |
adverbs = ["cheerfully", "uneasily", "abruptly"]; | |
//list all the verbs (example of how to loop through the array) | |
for(var i=0;i<verbs.length;i++) { | |
console.log(verbs[i]); | |
} | |
//make a random sentence and draw it to the screen | |
var sentence = "The "; | |
sentence += nouns[floor(random(nouns.length))] + " "; | |
sentence += verbs[floor(random(verbs.length))] + " "; | |
sentence += adverbs[floor(random(adverbs.length))] + "."; | |
text(sentence, 100, 300); | |
} | |
function draw() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment