Lab 2: Gossip

In Labs 2 and 3, students learn a new idea: not only can they assemble existing blocks (code) to create sequences (scripts), they can also encapsulate an entire script into a single new block of their own design, which they can then use as if that block had always existed. This process—one aspect of abstraction—is basic to computer science. Students will see how a multi-part script can be "hidden" inside a block (so students don't need to see all the details of the block while using it) and given a name (so they can easily know what it does and can use it more than once).

In this lab, students program two sprites to gossip with each other, picking randomly from words and ideas that students specify. The context is whimsical—students generally enjoy teaching a computer to gossip and find the results funny—but the ideas they are learning are deep. Getting a computer to generate (and understand) natural language has been the serious work of computer scientists for decades; Siri is one of the results. Students first experiment with blocks that have been built for them, seeing what they do. Then they learn to edit and modify these blocks. Finally, they create a new block of their own by using the same structure they've seen in the blocks they've edited but now with new content. In doing so, they will learn how to create lists of data, select data from those lists, and combine data in new ways. In Lab 3, they will extend this knowledge to another aspect of abstraction—learning how to give blocks inputs.

Pacing

These estimates are for the lab pages only. Additional time will be required for Computing in the News or other activities.
The 5 lab pages could be split across 2–4 days (90–180 minutes). Expected times to complete follow:

Prepare

As a Class

Lab Pages

Solutions

Correlation with 2020 AP CS Principles Framework 

Computational Thinking Practices: Skills

Learning Objectives:

Essential Knowledge: