Lesson 9: My Loopy Robotic Friends

Overview

Building on the initial "My Robotic Friends" activity, students tackle larger and more complicated designs. In order to program their "robots" to complete these bigger designs, students will need to identify repeated patterns in their instructions that could be replaced with a loop.

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.

Agenda

Warm Up (10 min)

Activity (30 min)

Wrap Up (5 min)

Extension Activities

View on Code Studio

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

  • Make sure each student has a Think Spot Journal.
  • Prepare a stack of 20 paper cups for each group of 4 students
  • (Optional) Print out one My Loopy Robotic Friends Cup Stack (Course B) - Image Pack per group of 4 students

OR

  • Display the My Robotic Friends Symbol Key (Course B) - Key where students can reference throughout the lesson.
  • Print and cut out Paper Trapezoid Template - Manipulatives for each group if your class is not going to use cups.
  • Print out one set of My Loopy Robotic Friends Cup Stack (Course B) - Image Pack per group.

Links

Heads Up! Please make a copy of any documents you plan to share with students.

For the Students

Vocabulary

  • Loop - The action of doing something over and over again.
  • Repeat - To do something again.

Support

Report a Bug

Teaching Guide

Warm Up (10 min)

My Robotic Friends Review

Robot Symbols

Goal: This review will refresh the students’ minds about how quickly programs for the "My Robotic Friends" activity can get intense.

Display: Show the resource mrf-symbols-b not found 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 "My Robotic Friends" Cup Stack Pack and program with each other as a reminder of rules and terminology.

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: 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 min)

Introduction and Modeling

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.

3 cup solution

Think: Ask students to think quietly about where in this program they can find a pattern of instructions that repeat uninterrupted (one repetition after another).

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.

Model: Using one of the repeating patterns that the class identified, model how Circle the instruction or pattern that repeats, write the number of loops near that circle, then cross out the rest of the arrows.

looped code

Repeat this until the entire program has been shortened, then re-write the program in a way where students can see how much more simple the resulting instructions are.

Looping Your Robots

Group: Place students into groups of 4. Each group should then further break down into two pairs - each pair will develop their own program "run" on the other pair.

Distribute: Give each group one stack of cups or paper cutouts.

Display: Show My Loopy Robotic Friends Cup Stack - Image Pack to the class or hand out individual copies for groups to use. Have each pair (not group) choose which stack they would like their robot to do. Encourage pairs to select a more complicated pattern this time around.

Teaching Tip

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?

Discuss: Let each group discuss how the stack should be built, then instruct each group to translate the algorithm into symbols. Make sure each group writes down the symbol algorithm somewhere for the "robot" to read later. As students are working on their programs, remind them to be on the lookout for opportunities to replace a repeating pattern with a loop.

Do: When groups have finished their instructions, have each pair trade with another pair to run one another's code. Remind students to be on the lookout for bugs, but not to interrupt a robot until it's finished running the program.

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:

  • How did they identify the loops?
  • Are there other ways those loops could have been written?
  • How much shorter is the program with loops than it would be without?
  • Is the program easier to understand with loops, or written out longhand? Why?

Wrap Up (5 min)

Journal Prompts:

  • Draw one of the Feeling Faces - Emotion Images that shows how you felt about today's lesson in the corner of your journal page.
  • Have the students write or draw something in their journal that will remind them later what loops are. This can come from a prompt like:
    • What does "repeat" mean to you?
    • Draw a picture of you repeating something.

Extension Activities

  • 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.

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.

Cross-curricular Opportunities

This list represents opportunities in this lesson to support standards in other content areas.

Common Core English Language Arts Standards

L - Language
  • 1.L.6 - Use words and phrases acquired through conversations, reading and being read to, and responding to texts, including using frequently occurring conjunctions to signal simple relationships (e.g., because).
SL - Speaking & Listening
  • 1.SL.1 - Participate in collaborative conversations with diverse partners about grade 1 topics and texts with peers and adults in small and larger groups.
  • 1.SL.1.a - Follow agreed-upon rules for discussions (e.g., listening to others with care, speaking one at a time about the topics and texts under discussion).
  • 1.SL.1.b - Build on others’ talk in conversations by responding to the comments of others through multiple exchanges.
  • 1.SL.1.c - Ask questions to clear up any confusion about the topics and texts under discussion.

Common Core Math Standards

MD - Measurement And Data
  • 1.MD.4 - Organize, represent, and interpret data with up to three categories; ask and answer questions about the total number of data points, how many in each category, and how many more or less are in one category than in another.
MP - Math Practices
  • MP.1 - Make sense of problems and persevere in solving them
  • MP.2 - Reason abstractly and quantitatively
  • MP.3 - Construct viable arguments and critique the reasoning of others
  • MP.5 - Use appropriate tools strategically
  • MP.6 - Attend to precision
  • MP.7 - Look for and make use of structure
  • MP.8 - Look for and express regularity in repeated reasoning

Next Generation Science Standards

ETS - Engineering in the Sciences
ETS1 - Engineering Design
  • K-2-ETS1-1 - Ask questions, make observations, and gather information about a situation people want to change to define a simple problem that can be solved through the development of a new or improved object or tool.
  • K-2-ETS1-2 - Develop a simple sketch, drawing, or physical model to illustrate how the shape of an object helps it function as needed to solve a given problem.
  • K-2-ETS1-3 - Analyze data from tests of two objects designed to solve the same problem to compare the strengths and weaknesses of how each performs.