Dec 092020
The computer’s first Christmas card!
Based on a poem by Edwin Morgan
- Start with: reset
- Make a list of words:
- make “words [“happy “merry “jolly “very]
- Write the first part of the greeting:
- print [“Have “a]
- Choose a random word from the list to print:
- print item random 4 :words
- This means “Print a random item from the list of words” The 4 is because there are four words in the list so it chooses one from 1 to 4 in the list
- Now make it print two words instead like this:
- print [item random 4 :words item random 4 :words]
- Put a repeat around the random words line:
- repeat 10
- [
- ….
- ]
- Finish with:
- print “Christmas
- Copy this code or make your own Christma[s picture, You could use your snowflake code from last week.
- repeat 30
[
pu setxy random 200 random 200 pd
repeat 18 [fd 30 rt 160]
]
- repeat 30
- *** Add more words to the list, eg berry, holly, bauble, tinsel… and don’t forget to change the random number to the number of items in the list
- *** Make a list of colours. Make your stars random colours.
- *** make sure that the first word is an adjective and the second a noun by making two lists: “adj and “nouns or “words1 and “words2
- *** Think of another project that uses lists and/or the random function