Lesson 7: Happy Loops
This activity revisits Happy Maps. This time, student will be solving bigger, longer puzzles with their code, leading them to see utility in structures that let them write longer code in an easier way.
This lesson serves as an introduction to loops. Loops allow for students to simplify their code by grouping commands that need to be repeated. Students will develop critical thinking skills by noticing repetition in movements of their classmates and determining how many times to repeat commands. By seeing "Happy Maps" again, students will get the chance to relate old concepts such as sequencing to the new concept of repeat loops.
Warm-Up (5 min)
Main Activity (20 min)
Wrap Up (8 min)
Students will be able to:
- Identify repeating code and shorten multiple actions into a single loop.
- Interpret a program with loops as a series of multiple actions.
- Print out a Happy Map Cards - Worksheet to display for the class
- Per each group of 2-3, print one of each: Happy Map Game Pieces - Manipulatives, Happy Map Cards XL - Worksheet, and Happy Map Game Pieces Bonus Pack - Manipulatives.
- Make sure each student has a Think Spot Journal - Reflection Journal.
Heads Up! Please make a copy of any documents you plan to share with students.
For the Students
- Happy Map Cards - Worksheet
- Happy Map Cards XL - Worksheet
- Happy Map Game Pieces - Manipulatives
- Happy Map Game Pieces Bonus Pack - Manipulatives
- Loop - The action of doing something over and over again.
- Repeat - Do something again
Warm-Up (5 min)
Happy Maps Review
This lesson builds off of the Happy Maps actvity from earlier in the year. Students might benefit from a quick refresher before you hop into the difficult stuff.
Model: Select one of the maps that your class covered together in the last lesson.
Have students look at the puzzle, then think-pair-share their solution for how they would get the Flurb to the fruit (using the symbols from last time).
Think: Do you remember writing programs to get the Flurbs to the fruit? What would this program look like coded with arrows?
Pair: Have students discuss for about 90 seconds.
Share: Ask a student to use their fingers to point in the direction of the arrows that they chose to solve this puzzle.
Main Activity (20 min)
This portion of the lesson should help students see that there is an easier way to handle repetitive code than to brute force a solution with dozens of the same symbols.
Model: Once you are confident that your students remember Happy Maps, pull up one of the new -- and much longer -- Happy Maps XL.
Can your students help you program these maps? The resulting code might look something like this:
It's a bit longer, isn’t it?
The point of this discussion is to get students to see that, sometimes, many symbols are repeated and they can lump all of those movements into a single icon.
Give students the opportunity to brainstorm shorter ways to relay the code that they’re creating. (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.)
Ideally, students will land on a method that looks like this one:
Which can be reduced even further to this:
Eventually, students can write programs like this on the fly:
Define: 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” will be used interchangeably in Code Studio.
Now that students are familiar with the ability to repeat lots of code using a single loop, select an XL map and let them help you write code for the situation. Do this as many times together as a class as you need, then set students off in groups to solve some problems on their own. You may also need to add the Happy Map Game Pieces Bonus Pack - Manipulatives to adapt this activity for loops.
Circulate: Make sure to walk around and have students run through their code with you watching. 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
Wrap Up (8 min)
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.
- 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. Prompts include:
- What does "repeat" mean to you?
- Draw a picture of you repeating something.
- Create a life-size grid on the rug with tape and have student bring stuffies to school. Now students can program friends to move their actual stuffies as directed in the programs.
- Have students create their own maps for other students to solve using loops.
- Draw a program on the board that uses several sets of repeated commands and have students take turns coming to the front to swap symbols for repeat loops.
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-14 - Debug (identify and fix) errors in an algorithm or program that includes sequences and simple loops.
This list represents opportunities in this lesson to support standards in other content areas.
Common Core English Language Arts Standards
L - Language
- K.L.6 - Use words and phrases acquired through conversations, reading and being read to, and responding to texts.
SL - Speaking & Listening
- K.SL.1 - Participate in collaborative conversations with diverse partners about kindergarten topics and texts with peers and adults in small and larger groups.
- K.SL.2 - Confirm understanding of a text read aloud or information presented orally or through other media by asking and answering questions about key details and requesting clarification if something is not understood.
- K.SL.5 - Add drawings or other visual displays to descriptions as desired to provide additional detail.
Common Core Math Standards
G - Geometry
- K.G.1 - Describe objects in the environment using names of shapes, and describe the relative positions of these objects using terms such as above, below, beside, in front of, behind, and next to.
MP - Math Practices
- MP.1 - Make sense of problems and persevere in solving them
- MP.2 - Reason abstractly and quantitatively
- MP.4 - Model with mathematics
- 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.