Making Programs Talk

In this lab, you will program two sprites to gossip.
Image of stage with two characters talking. One says, 'my cat is in a band with Jake,' and the other says 'Oh, but... Mr. C loves my cat.'

On this page, you will experiment with an existing program as an introduction to the project.

Exploring Custom Blocks

  1. Click here to load this file. Then save it to your Snap! account.
  2. You'll need to be logged in to save to your account. You may wish to review how to log in at Unit 1 Lab 1 Page 1: Getting Started with Snap!
  3. Perform each experiment (A-D) several times.
  4. Talk with Your Partner
    • What does each reporter block report?
      who block does what block gossip block
    • What happens when you click this script (labeled D)?
      say (gossip) broadcast (your turn)
There is nothing exactly like say (gossip) or say (gossip) for (3) secs on the AP Exam because they don't have sprites and speech balloons, but their way of showing this text to the user is
if it's written as text or a white rounded rectangle containing first the word 'DISPLAY' in all caps and then a smaller white rectangle containing the word 'gossip' in lower case if it's shown as blocks.

You won't have to be able to write code in this notation on the AP exam. You just have to be able to read it so you can answer questions about it.

Would you like to make the blocks bigger?

In the Settings menu (Settings menu gear icon), choose "Zoom blocks...", and adjust the slider.

AAP-3.B.6, DAT-1.A.5

Abstraction is the most fundamental idea in computer science, but it's hard to define until you've seen some examples. The most basic kind of abstraction is to give a name to something in a program. For example, here we gave the name who to the idea "pick an item at random from this list of people (or cats)." This is called procedural abstraction because we use a procedure (a block) to name the idea. This makes your code readable. You'll see other kinds of abstraction later.


If you find yourself wanting to copy and paste code from one place to another without changing it, then give it a name (open a Block Editor and paste the code there) and call your procedure in both places. If you discover later on that you need to fix a bug in this code, you only have to change it once instead of finding every copy throughout your program.

Exploring a Second Sprite 

  1. Pair Programming Swap In the sprite corral, click on the green sprite named "Sprite(2)" to control its scripts and costumes.
  2. Perform each experiment (A-C) several times.
  3. Talk with Your Partner Write down what broadcast does.
  4. Talk with Your Partner Discuss how who2 compares to who and how gossip2 compares to gossip.
  5. Save your work Make Sprite(2) tell Sprite to respond. What happens?

    The broadcast block sends a message to all the sprites. To set the message, click the down arrow and select "new..."
    broadcast block with menu open showing two options: your turn, new...

    For more information about the when I receive block, right-click (or control-click on a Mac) the block and select "help..."
    when I receive block with right-click menu open showing four options: help..., duplicate, delete, script pic...