Lesson 7: My Loopy Robotic Friends Jr.
45 minutes
Overview
This context-setting lesson builds on the initial "My Robotic Friends" activity, featuring larger and more complicated designs.
Purpose
This lesson serves as a reintroduction to loops, using the now familiar set of "robot" programming instructions. Students will develop critical thinking skills by looking for patterns of repetition in the movements of classmates and determining how to simplify those repeated patterns using loops.
Standards
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.
Agenda
Objectives
Students will be able to:
- Identify repeated patterns in code that could be replaced with a loop
- Write instructions that use loops to repeat patterns
Preparation
- Prepare a stack of 20 paper cups (or *paper trapezoids) for each group of 4 students.
- Display the *symbols where students can reference throughout the lesson.
- (Optional) Print out one *Cup Stacking Ideas per group of 4 students.
Links
Heads Up! Please make a copy of any documents you plan to share with students.
For the teachers
- CSF - Course C - Slides 2022-2023 - Slides (Download)
For the students
- My Robotic Friends - Cup Spacing
- My Robotic Friends - Symbol Key
- My Robotic Friends - Cup Stacking Ideas
- My Robotic Friends - Paper Trapezoid Template
Vocabulary
- Loop - The action of doing something over and over again.
- Repeat - To do something again.
Teaching Guide
Warm Up (10 minutes)
Reflect
Display: Show “Reflect” slide
Reflect: In the previous lesson, which shapes repeated lines of code? What lines of code did they repeat?
Vocabulary
Display: Show “Vocabulary” slide
-
Loop - The action of doing something over and over again.
-
Repeat - To do something again.
Introduction
My Robotic Friends Review
Display: Show “Remember This?” slide
Goal: This review will refresh the students’ minds about how quickly programs for the "My Robotic Friends" activity can get intense.
Display: Show the *Symbol Key that we used in "My Robotic Friends". For each of the four symbols, ask students to show you what it looks like for a robot to follow that instruction.

Model: With the class together as a group, pull an easy puzzle from the *Cup Stacking Ideas and program with each other as a reminder of rules and terminology.
Display: Show “Now Try This!” slide
Next, pull a puzzle that’s slightly harder, but also requires a lot of steps like the one below.

Volunteer: Ask a volunteer (or a group of volunteers) to come forward to help program this one on the board. If you make them stick strictly to the “no symbols other than those on the key” rule, it will probably take a while!
Display: Show “One More Time!” slide
Display: Now, bring up this image:

What is the reaction of the class?
Prompt: Give students the opportunity to brainstorm shorter ways to relay the code that they’re about to create. (This bit can be skipped over if your students start saying things like: “Move forward 6 times.” Since that will open the discussion about how to show “six times” with symbols.)
Once students have put together the idea of “repeating” code, give them the vocabulary around it. Make sure to share with them that often the terms “repeat something” and “loop something” are often used interchangeably.
Activity (30 minutes)
Introduction and Modeling
Display: Show “My Loopy Robotic Friends” slide
Set Up: Have stacks of cups or cut paper trapezoids available for groups.
Display: Take the program from one of your previous cup stacks and display it for the class, or use the one below.
Think: Ask students to think quietly about where in this program they can find a pattern of instructions that repeat uninterrupted (one arrow repeated over and over).
Pair: Turn to a neighbor and share one of the repeating patterns you found.
Share: Ask a few students to share out the patterns they identified. Try to pull out different approaches to grouping patterns. For each pattern, ask students to identify how many times the pattern repeats.
Display: Show “Sample Answer” slide
Model: Using one of the repeating patterns that the class identified, model how to Circle the instruction or pattern that repeats, write the number of loops near that circle, then cross out the rest of the arrows.
Repeat this until the entire program has been shortened, then re-write the program in a way where students can see how much simpler the resulting instructions are.
Looping Your Robots
Display: Show “Looping Your Robots” slide
Say:
-
Once you are in your group, divide into partners.
-
Look at Cup Stacking Ideas.
-
With your partner, choose one design for your robot to do.
Display: Show “The “Program”” slide
Say:
-
Discuss how the stack should be built, using only arrows.
-
Write down your algorithm on a piece of paper.
-
Replace any repeated actions with a loop.
Looking for Loops: Be sure to keep your eyes open for students using loops. Try to avoid correcting their overall algorithms or prescribing a solution, but feel free to direct students towards patterns that could be shortened by using a repeat circle.
Watch students as they run through the code. Are there any bugs? Use the debugging questions to help them find a solution.
- What does it do?
- What is it supposed to do?
- What does that tell you?
- Does it work at the first step?
- Does it work at the second step?
- Where does it stop working?
Display: Show “Running and Debugging Your Robots” slide
Say:
- Now it’s time to be a robot!
- Trade algorithms with the other partners in your group.
- Be on the lookout for bugs. If you see one, have the robot finish the instructions as best as it can.
- Discuss the bug with your partners and come up with a solution.
- Keep testing the algorithm until it works!
Display: Show “Discuss” slide
Discuss: When all of the pairs have had a chance to run their programs, ask a few to share their solutions with the class. Use this opportunity to discuss how groups came up with different solutions to the same puzzle. In particular, you might ask of each program:
- Did you identify any loops?
- Are there other ways those loops could have been written? How?
Wrap Up (5 minutes)
Reflection
Display: Show “Reflect” slide
Reflect: Is it easier to understand programs with loops, or programs written out longhand? Why?
Extended Learning
Use these activities to enhance student learning. They can be used as outside of class activities or other enrichment.
- Have students draw their own cup stacking creations for someone else to code.
- Provide students with algorithms that utilize repeats, then have them expand the program back out to a full step-by-step version.
This work is available under a Creative Commons License (CC BY-NC-SA 4.0).
If you are interested in licensing Code.org materials for commercial purposes contact us.