Lab 2 Write Up

Name: Zak "The Legend" Singh

Period: 7

Assignment:Scratch Lab #2

Lab Overview

In this lab we animated our name, tested out embedded loops, and tried out loops and conditional commands. HERE.

My Solution

For problem #1, I animated my name using the "next costume" block. For the embedded loops, I found that the first two loops worked. For the loop and conditional commands, I learned that the forever loop worked best.

Paired Programming

Problem 1

Questions

  1. Problem #3
    • The first one will because 10 x 10 = 100. The second one also works because it is 10 x 10 x 1, which equals 100.
  2. Problem #5
    • The forever loop works best because then whenever you touch it with your mouse it works, since it is always waiting to be touched.
  3. What are the types of loops contained in Scratch? What are the differences?
    • Forever, repeat, and repeat until. The forever loop keeps going forever. The repeat loop repeats it a set number of times.
  4. 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?
    • The repeat until structure would wrk best because then you could end it whenever you need it to without having to try and time it.
  5. Does the following loop structure work? Does it make sense? Why or why not?
    • No because once it says "Forever loop!" once it will get stuck in the second loop forever.
  6. How can sprites “know” when to begin an action? Is there more than one way?
    • They can know via either another sprite's broadcast or an if command.
  7. Are the following code snippets equivalent? Why or why not?
    • Yes, because they are the same thing, just reversed. The if command in the first is waiting for the space key to be pressed, while the second waits for the space key to not be pressed.