ST EK List
No Ek's found

Making Programs Talk

Ruthless Suggestions from Al

In this lab, you will program two sprites to gossip.
Gossip

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
      • These oval-shaped blocks are called reporters. We say they report a value.
      • Using the result from one reporter as the input to another reporter is called composition. For example, here's a piece of the who block:
        item (random) of (list{Senora, Ms. C, my cat, Hannah, Jake})
        In this expression, the value reported by the list block is used as an input to the item block.
    • What happens when you click this script (labeled D)?
      say (gossip) broadcast (your turn)
      • Say and broadcast are command blocks; they tell the computer to do something without reporting a value.

The say block says something to the user.

The report block reports something to the computer so that it can be used elsewhere in the program.

Here is the complete definition of the who reporter:
who reporter block definition: report (item (random) of (list (Señora) (Ms. C) (my cat) (Hannah) (Jake)))
Why not use say instead of report?
who command block definition: say (item (random) of (list (Señora) (Ms. C) (my cat) (Hannah) (Jake)))
If you do that, you can't use who as an input to another block such as the join in gossip. So, we have to make who be a reporter in order to use it in gossip:
gossip: (report (join (who) ( ) (does what) ( ) (who)))
  1. Just as you created an Alonzo costume in Unit 1 Lab Page 2: Programming Your App, you could give the gray sprite a costume.
    gossip sprite with costume
stage-and-sprite-corral Pair Programming Swap

Exploring a Second Sprite 

  1. In the sprite corral (see image at right), click on the green sprite named "Sprite(2)" to control its scripts and costumes.
    pic of sprite(2) in sprite corral
  2. Click the "Scripts" tab see the code that controls Sprite(2). Perform each experiment (A-C) several times.
  3. Talk with Your Partner Discuss how who2 compares to who and how gossip2 compares to gossip.
  4. Now Is a Good Time to Save
  1. Give Sprite(2) a costume too.
  2. You might need to point in direction (90).