[Guided Practice] He's Making a List. Checking it twice.
Assignment Specifics
In our lesson videos we looked at a couple of ways to use lists to help us with different programs. In this activity you will interact with three different programs of different difficulty and functionality to look at some additional ways that you can use lists in Scratch programs.
Hurricane Tracker
Visit this animated map of Hurricane Irma from 2017.- https://scratch.mit.edu/projects/222347707/editor/
- Turn on the Lat, Long, and Wind lists and examine the data.
- Notice that each list has the same number of items.
- How do you think these lists fit together?
- How does data in slot N of each list (for example, slot 5) fit together?
- How is it used in the program?
Random Stories
A few weeks ago we used "Hey Diddle Diddle" as a Mad Lib. Today I want you to work with it again, but instead as part of a Random Story generator.
Remix a copy of:
Look carefully at the code that is in this starter project.
- Notice that there are seven variables representing the seven "holes" in the story.
- Only one of these is used properly right now.
- Press the green flag several times and see what happens in the current story
- Instead of asking the user to provide input for the mad lib we want this program to read from seven corresponding lists.
- At the moment only Animal1 and "chosen Animal1" are set up properly.
Let's finish this program:
- Finish the "places everyone" on Scratchy Cat so that he sets up the remaining six variables from their lists.
- Modify the Moon Jumper sprite so that it changes costumes to correspond with what got selected by the program.
- Add one additional object to each of the 7 lists and then fix the code so that all five objects are possible in the story.
- Add a third sprite that represents the various options for the noun that "runs" away with the spoon. Modify the program so that when you run the code this visual element is included.
RAGBRAI Map
Visit the page for this interactive RAGBRAI Map.
- Run this program entering at least two different years from 1973 to 2022.
- What happens?
- Run this program entering at least one year BEFORE 1973. After 2022?
- What happens?
- Click on the checkboxes next to the lists named Night0, Night1, and Night2.
- Notice that each of these lists has a length of 42 items (so do the other 5 lists with Night in them).
- Look at the code under the stage and locate the line that says:
- Switch over to the Bicycle sprite if you aren't there yet.
- Look under the various "when I receive" blocks. Notice how slotnumber is used to read data from the lists such as Night0, Night1, and Night2.
- What does slotnumber represent?
- Unselect the checkboxes for the Night lists you just turned on. Instead click on the checkboxes next to the lists named LLCity, LLLat, and LLLon. Notice that these three lists are coordinated. Each list has 129 items.
- How do you think these lists go together?
- Look at the following block of code. How does it work?
The code for this program is much more complex than the code for the previous activities you have looked at. But click on the "See inside" button and check it out.