![]() The program is using these if statements to randomly choose numbers between 0-3, depending on the number, it’ll print the corresponding string (or word).īut this way is impractical considering that if I wanted to add more words, I’d have to do an if statement for every single one. To take it a step further, decided to use “if statements.” Once I added the “int” to make it an integer I was able to run the program and get a new word out of the list every time. Thought of storing the number within a variable that can call upon a random word, but this came up and said I have to convert to an integer. ![]() Now to figure out how to generate words randomly from the 4 listed so I don’t have to keep calling it with the text() function. The example above uses “noun1” which is the word “space” and so it appears in the window with the co-ordinates I have placed at 30, 30. I can call upon a word by using the text() and just plugging in the name of the variable. Used a list of strings at first to define the variables (noun0 – noun3) and labeled them as words, 4 for now. Started with defining the colour of the window and the text (black and white) – pretty simple. So I thought this was quite necessary and useful. I’m actually doing an assignment in my Copy Writing class where the basis of my group’s campaign is this – random words that don’t make sense. I came across a tutorial that uses strings and arrays to generate random words which sound really funny. Since I’ve been doing a lot of graphic-based blogging with Processing, thought it would be fun to try something a little different.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |