Published using Google Docs
CS-Scratch Lab #2
Updated automatically every 5 minutes

Introduction to Computer Programming

Scratch Lab #2

Loops and Repetition

This lab consists of two parts.  First, a pair programming assignment that will familiarize you with the scratch IDE.  After completing the pair assignment you should begin work individually.  

Table of Contents

Pair Programming:

Individual Lab:

Problem #1-Name Animation

Problem #2-Polygons Revisited

Problem #3-Embedded Loop

Problem #4-Repeat Until

Problem #5-Loop & Conditional

Question #1-Loops

Question #2-No end in sight

Question #3-Forever Loops

Question #4-Sprite Communication

Question #5-Conditionals

Pair Programming:

Screen Shot 2015-07-28 at 5.55.36 AM.png

Individual Lab:

You must complete 3 of the following 5 problems.  If you adequately complete those three and still have time, you are expected to continue working on the other problems.  You are assessed on both the correctness of your code as well as full use of the lab time given during class.

You need to be able to answer all of the following questions.  Your answers will be posted on your website.

Problem #1-Name Animation

Create your own sprite that contains your name.  You need to animate it using multiple costumes.

Problem #2-Polygons Revisited

Now that you have the ability repeat commands with loops, rewrite your solution for polygon creation.  At a minimum, your sprite should be able to create a regular hexagon.  For a challenge, try to create a circle!

Problem #3-Embedded Loop

Try the following loop structures.  Which will result in the sprite moving 100 steps?  Think about WHY this is happening.  You should embed your answers as comments (right click and select “add comment”)

Screen Shot 2015-07-29 at 6.12.16 AM.png

Problem #4-Repeat Until

Create an animation containing two sprites.  The first sprite should animate until a given event (i.e. touching the edge, touching a sprite, a key is pressed…).  After the event occurs, the first sprite should broadcast a message that triggers the animation for the second sprite.  For added difficulty have the sprites only show up during their animation, have the stage change and have some music play

Problem #5-Loop & Conditional

Using any sprite you’d like, run the following code.  Which seems to work the best?  Why?

Screen Shot 2015-07-29 at 6.19.47 AM.png

Please consider the following questions.  Note, you do not need to submit these questions, but are accountable for knowing the answers.

Question #1-Loops

What are the types of loops contained in Scratch?  What are the differences?

Question #2-No end in sight

If you are given a situation where you want an action to repeat, but you don’t know how long it should repeat for, which loop is the best structure to use?  Why?

Question #3-Forever Loops

Does the following loop structure work?  Does it make sense?  Why or why not?

Screen Shot 2015-07-29 at 6.26.59 AM.png

Question #4-Sprite Communication

How can sprites “know” when to begin an action?  Is there more than one way?

Question #5-Conditionals

Are the following code snippets equivalent?  Why or why not?

Screen Shot 2015-07-29 at 6.31.34 AM.png