Lab #2 Write Up

Name: Kelly Yokoi

Period: 7

Assignment: Lab #2

Lab Overview

Scratch Lab #2 focused on loops and repetition in scratch. Problem #1 started out basic with the creation of my own sprite that contains my name and has multiple costumes. I revisited the drawing of polygons in Problem #2. Using loops I had to create a hexagon and a circle. Problem #3 had me analyze embedded loops.

My Solution Problem #1

I first drew my sprite and wrote my name then I made multiple costumes and had the hand of the stick figure move a bit each time. I then had the sprite switch costumes every 0.2 seconds to look like it was waving.

Problem #1

My Solution Problem #2

For this problem I had the sprite first draw a circle by putting the pen down and using the repeat function to have the sprite move 10 steps and spin 15 degrees 24 times. I then lifted the pen and had the sprite move to where I wanted the hexagon. To draw the hexagon I put the pen down and had the sprite repeat the move of 2 steps so it would draw the hexagon slowly. That repetition was then put in a repetition of 6 along with 60 degree turning. This created my desired hexagon.

Problem #2

My Solution Problem #3

For problem #3 I just copied the scripts in the picture and put them on different sprites so I could compare them. One sprite would repeat 10 times a move of 10 steps. Another sprite would repeat 10 times the move of 1 step 10 times. For the third sprite the move of 5 steps was repeated 16 times and then that all was repeated 20 times along with a move of 1 step. The fourth step was a repeat of 1 step 20 times then a repeat of 5 steps 16 times. The 5th sprite was a forever loop repeating 10 steps 10 times.The Sprite that moved 100 steps was the first sprite.

Problem #4

Questions

  1. Question #1-Loops

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

    • There is the repeat loop which repeats the action a certain number of times. The forever loop repeats the action forever. There is also the repeat until loop which repeats the action until another action is performed.
  2. 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?

    • Do the repeat until blank loop so the sprite will stop will stop when the certain action started.
  3. Question #3-Forever Loops

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

  5. Question #4-Sprite Communication

  6. How can sprites "know" when to begin an action? Is there more than one way?

  7. Question #5-Conditionals

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

Click HERE to return to homepage.