Lesson 8: Loops with Scrat
Overview
Building on the concept of repeating instructions from "Happy Loops," this stage will have students using loops to get to the acorn more efficiently on Code.org.
Purpose
In this lesson, students will be learning more about loops and how to implement them in Blockly code. Using loops is an important skill in programming because manually repeating commands is tedious and inefficient. With these Code.org puzzles, students will learn to add instructions to existing loops, gather repeated code into loops, and recognize patterns that need to be repeated.
Agenda
Warm Up - The Unplugged Foundation (10 min)
Bridging Activity - Choose One
Online Foundation: Preview Loops in Ice Age
Main Activity (30 min)
Wrap Up (5 - 10 min)
Extended Learning
View on Code Studio
Objectives
Students will be able to:
- Construct a program using structures that repeat areas of code
- Improve existing code by finding areas of repetition and moving them into looping structures
Preparation
- Review the previous unplugged lesson and develop questions to remind students why loops are used.
- (Optional) Pick a couple of puzzles to do as a group with your class.
- Gather supplies from previous Happy Loops to reuse for warm up
- Make sure each student has a journal.
Links
Heads Up! Please make a copy of any documents you plan to share with students.
For the Students
- Feeling Faces - Emotion Images
- Happy Map Cards - Worksheet
- Happy Map Game Pieces Bonus Pack - Manipulatives
- Happy Map Game Pieces - Manipulatives
- Unplugged Blockly Blocks (Grades K-1) - Manipulatives
Vocabulary
- Loop - The action of doing something over and over again.
- Repeat - To do something again.
Support
Report a Bug
Teaching Guide
Warm Up - The Unplugged Foundation (10 min)
Teaching Tip
If your class has already learned cardinal directions, then changing "Up" and "Down" to "North" and "South" shouldn't be a problem. If they have not, we have provided a handy worksheet with the Code.org Compass Rose that you can use to get students onboard. This conversion will come in handy for nearly all of the online puzzles aimed at kindergarten and first grade.
Let students know that they will see those letters in their online programs next to the direction arrows.
Review Unplugged Activity
This lesson relies on the concept of repeat
loops that students learned in the previous unplugged activity, Happy Loops. It is important to bring this idea from the real world into digital form so that students understand how to use Blockly blocks to repeat a task multiple times.
Display: Show students map from the "Happy Loops" exercise that they completed in the lessons prior to this one.
Discuss: Ask students to recall the symbols used in "Happy Loops."
- What happens when "East" arrow is circled with the number 3? (It moves E 3 times)
- What is it called when we circle an arrow and add a number? (A
repeat
loop)
Transition: Once you are satisfied that your students remember "Happy Loops", you can move into the Bridging Activity.
Bridging Activity - Choose One
Choose one of the following to do with your class:
Teacher Tip:
If you predict that your students will have trouble with the idea of using repeat
loops to not only move, but also pick corn, you can introduce this idea in the Bridging Activity. This will help students understand that loops can have many different uses.
Unplugged Activity Using Paper Blocks
Select an empty Flurb map from the Happy Map Cards - Worksheet and give students Unplugged Blockly Blocks (Grades K-1) - Manipulatives prefilled with the collect
command, a repeat
loop, and the cardinal commands like E →
(East) and W ←
(West). Now, have the students program the Flurb from their desks using the paper Blockly blocks to get the Flurbs to collect the fruit. Make sure that they understand that the blocks need to go from top to bottom and they all need to touch!
Previewing Online Puzzles as a Class
Pull a puzzle from the corresponding online puzzles. We recommend puzzle 4. Using arrows from the Happy Map Game Pieces - Manipulatives and Happy Map Game Pieces Bonus Pack - Manipulatives, have students lay out a pattern that they think will get the Harvester to pick all the corn. Ask the students to share. See how many other students had the same answer!
Online Foundation: Preview Loops in Ice Age
To finish the connection, preview an online puzzle (or two) as a class.
Model: Reveal an entire online puzzle from the progression to come. We recommend Lesson 8, Puzzle 5. Point out the "Play Area" with Scrat and the acorn, as well as the "Work Space" with the Blockly code. Explain that this Blockly code is now the language that the class will be using to help Scrat get to the acorn. Do students see any similarities to the exercise that they just did? What are the big differences?
Work with your class to drag code into the workspace in such a way that Scrat (eventually) gets to the acorn.
Transition: Students should now be ready to transition to computers to complete online puzzles on their own.
Main Activity (30 min)
Online Puzzles
As students work through the puzzles, see if they can figure out how many blocks they use with a loop vs. without a loop.
Teacher Tip:
Show the students the right way to help classmates by:
- Don’t sit in the classmate’s chair
- Don’t use the classmate’s keyboard
- Don’t touch the classmate’s mouse
- Make sure the classmate can describe the solution to you out loud before you walk away
Circulate: Teachers play a vital role in computer science education and supporting a collaborative and vibrant classroom environment. During online activities, the role of the teacher is primarily one of encouragement and support. Online lessons are meant to be student-centered, so teachers should avoid stepping in when students get stuck. Some ideas on how to do this are:
- Utilize Pair Programming - Student Video whenever possible
- Encourage students with questions/challenges to start by asking their partner
- Unanswered questions can be escalated to a nearby group, who might already know the solution
- Remind students to use the debugging process before you approach
- Have students describe the problem that they’re seeing. What is it supposed to do? What does it do? What does that tell you?
- Remind frustrated students that frustration is a step on the path to learning, and that persistence will pay off.
- If a student is still stuck after all of this, ask leading questions to get the student to spot an error on their own.
Wrap Up (5 - 10 min)
Journaling
Having students write about what they learned, why it’s useful, and how they feel about it can help solidify any knowledge they obtained today and build a review sheet for them to look to in the future.
Journal Prompts:
- What was today’s lesson about?
- Draw one of the Feeling Faces - Emotion Images that shows how you felt about today's lesson in the corner of your journal page.
- Draw Scrat and an acorn.
- Draw yourself using a loop to do an everyday activity, like brushing your teeth.
Extended Learning
So Moving
- Give the students pictures of actions or dance moves that they can do.
- Have students arrange moves and add loops to choreograph their own dance.
- Share the dances with the rest of the class.
Connect It Back
- Find some YouTube videos of popular dances that repeat themselves.
- Can your class find the loops?
- Try the same thing with songs!
Student Instructions
Help Scrat across the slippery ice to get to the acorn!
Student Instructions
Use both and blocks to get to the acorn!
- Ice Age Loops
- 3
Student Instructions
Can you get to the acorn with just one move west block? Try using a loop!
Student Instructions
Add one more block to get Scrat all the way to the acorn!
Student Instructions
Can you add a loop to get to the acorn?
Student Instructions
Scrat really wants that acorn!
Student Instructions
Can you fix this code?
Student Instructions
The acorn is so far away! Can you use loops to help Scrat get there?
- Challenge
- 10
Student Instructions
Help Scrat get all the way over to the acorn!
Student Instructions
Help Scrat get to the acorn!
Student Instructions
Get to the acorn any way you can!
Standards Alignment
View full course alignment
CSTA K-12 Computer Science Standards (2017)
AP - Algorithms & Programming
- 1A-AP-09 - Model the way programs store and manipulate data by using numbers or other symbols to represent information.
- 1A-AP-10 - Develop programs with sequences and simple loops, to express ideas or address a problem.
- 1A-AP-11 - Decompose (break down) the steps needed to solve a problem into a precise sequence of instructions.
- 1A-AP-14 - Debug (identify and fix) errors in an algorithm or program that includes sequences and simple loops.