Learn creative coding writing simple programs
56. Silly poet writes absurd things
We had a program that wrote a random adjective and a random noun together. It was printing things like "tall tree" or "sticky sky". We continue changing this program so it can write longer sentences. Until now we had an array with adjectives and another array with nouns. We add three new arrays: articles, verbs and prepositions. This allows us to build rather long sentences.
To print the words we create our own function called write_word(). This function only receives one parameter: an array of words. So if we want to print a random adjective, we use write_word(adj). If we want to print a random preposition, we call write_word(pre).
The function receives the whole list of words. Looks at how many words there are in this list, and prints one of them randomly.
Try to stay close to the topic of this episode. Use the Processing forums for help with unrelated Processing projects (or hire me for help ;-)
To indicate that a word in your comment is code, use the `backtick`. Example
Do `float` and `int` smell similar?
To highlight code blocks, surround it with ``` code-fences ``` like this:``` void setup() { size(600, 600); } ```