Lesson 1: My Robotic Friends

Algorithms | Debugging | Unplugged

Overview

Using a special set of offline commands, students will design algorithms to instruct a "robot" to stack cups in different patterns. Students will take turns participating as the robot, responding only to the algorithm defined by their peers. This segment teaches students the connection between symbols and actions, the difference between an algorithm and a program, and the valuable skill of debugging.

Purpose

This unplugged lesson brings the class together as a team with a simple task to complete: get a "robot" to stack cups in a specific design. Students will work to recognize real world actions as potential instructions in code. The art of following precise instructions will also be practiced, as students work to translate algorithms into code, using the symbols provided. If problems arise in the code, students should work together to recognize bugs and build solutions. This activity lays the groundwork for the programming that students will do throughout the course as they learn the importance of defining a clearly communicated algorithm.

Agenda

Warm Up (5 min)

Activity (45 min)

Wrap Up (10 min)

View on Code Studio

Objectives

Students will be able to:

  • Reframe a sequence of steps as an encoded program
  • Identify and address bugs or errors in sequenced instructions

Preparation

Links

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

For the Teacher

For the Students

Vocabulary

  • Algorithm - A list of steps to finish a task.
  • Bug - Part of a program that does not work correctly.
  • Debugging - Finding and fixing problems in an algorithm or program.
  • Loop - The action of doing something over and over again.
  • Program - An algorithm that has been coded into something that can be run by a machine.
  • Repeat - Do something again

Support

Report a Bug

Teaching Guide

Warm Up (5 min)

Discussion Goal

The goal of this quick discussion is to call out that while robots may seem to behave like people, they're actually responding only to their programming. Students will likely refer to robots from movies and TV that behave more like humans. Push them to consider robots that they've seen or heard of in real life, like Roombas, or even digital assistants like Amazon Alexa.

Talking to Robots

Discuss: Start by asking the class if anyone has heard of robotics. Has anyone seen a robot or touched one? Does a robot really “hear” you speak? Does it really “understand” what you say?

Say: Robots can only do what they've been instructed or programmed to do. In order to accomplish a task, a robot needs to have a list of instructions (sometimes called an algorithm) that it can read. Today, we are going to learn what it takes to make that happen.

Activity (45 min)

Introduction and Modeling

Robot Symbols

Teaching Tip

Differentiation Options:


Simplify: Does this all feel a little complicated for your classroom? Here are a couple of tips to simplify the process:

  • Load lots of steps into the ups and downs
    • Up means that the cup automatically goes up as high as it needs to
    • Down means that it automatically goes down until it lands on something
    • Hand automatically returns to cup stack after setting down a cup

Intensify: Are your students more advanced? Do you want this lesson to relate more closely to the online puzzles? Here are some modifications that you can make:

  • One arrow corresponds to one movement
    • When a cup is removed from the stack, it returns to table-level before moving
    • Students need to use multiple "up" arrows to lift the cup multiple levels
    • Students need to use multiple "down" arrows to lower the cups multiple levels
    • Students need to use the "back" arrows to get back to the cup stack
    • Set Up: Have stacks of cups or cut paper trapezoids available for groups.

Display: Display the My Robotic Friends - Symbol Key or write the allowed actions on the board - make sure these are in a place where they can be seen for the whole activity. Explain to the class that these will be the only six actions that they will be using for this exercise. For this task, they will instruct their “robot” friend to build a specific cup stack using only the commands listed on the key.

Model: In order to explain how the instructions are intended to work, model for the class how to create and follow an algorithm for replicating a simple pattern. Place a single stack of cups in front of you to start.

Display: Hold up the pattern you plan to model. A simple three cup pattern is a great place to start.

Prompt: Ask the class what the first instruction should be, using only the six instructions allowed. The first move should be to "pick up cup." If students suggest something else from the list, perform that action and allow them to see their error. If they suggest something not from the list, make a clear malfunction reaction and let them know that the command is not understood.

With cup in hand, ask the class to continue giving you instructions until the first cup is placed. This is a great place to clarify that a "step forward" and "step backward" each imply moving half a cup width. See the image below for reference.

3 cup pattern

Continue asking for instructions from the classroom until you have completed the entire design.

Once your stack is complete, point out that they just gave you a list of instructions for completing a task. That's an algorithm. Algorithms are great for sharing ideas, but spelling them out word by word can take a long time. That's what the symbols are for! When you encode an algorithm into symbols that a robot (or computer) understands, that's called programming.

Ask the class to help you write the "program" for that first move, and then the rest of the moves necessary to complete the pattern. Depending on the confidence of your students, you might switch back and forth frequently between acting as the "robot" and writing down the code, or you might push them to write the whole program before you will implement it. One possible solution looks like this:

3 cup solution

Volunteer: Once the class has completed the model program, ask one of the students to come up and act as the "robot" to ensure that the program really works. Encourage them to say the instructions out loud as they "run" the code.

Programming 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 to be "run" by the other pair.

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

Display: Show Stacking Cup Ideas - Manipulatives to the class or hand out individual copies for groups to use. Have each pair (not group) choose which idea they would like their robots to do. Try to push for an easier idea for the first time, then have them choose a more complex design later on. Encourage pairs to keep their choice secret from the other half of their group.

Discuss: Give each pair time to discuss how the stack should be built, using only the provided symbols. Make sure each group writes down the "program" somewhere for the "robot" to read later.

Teaching Tip

Enforcing the rules: While the robot is working on the stack make sure that the class knows:

  • Programmers are not allowed to talk when the robot is working. This includes blurting out answers or pointing out when the robot has done something wrong.
  • Programmers should raise their hand if they see a bug.

Do: Once both of the group's pairs have decided on their algorithms, they can take turns being "robots" for each other by following the instructions each pair wrote. Encourage students to watch their "robot" closely to ensure that they are following instructions. If a student sees a bug and raises their hand, have the robot finish the instructions to the best of their ability. Afterward, have the students discuss the potential bug and come up with a solution. Continue repeating until the stack is built properly.

Circulate: Look for groups who are trying to take shortcuts by adding things (like numbers) to their code. Praise them for their ingenuity, but remind them that for this exercise, the robots do not understand anything but the provided symbols. If you like, you can hint that they should save their brilliant solution for the next time they play this game, since they might get the chance to use it soon!

Iterate: Depending on your time available, mix up the pairs and give them a chance to do a different pattern. Each time groups repeat the process, encourage them to choose a more challenging pattern.

Discussion Goal

Sense making: The goal of this discussion is to give students space to make sense of their experience both as robot and programmer. The questions are intentionally broad, but designed to get students thinking about the challenges of writing a clear program and the constraints of a robot or computer in interpreting your instructions.

Discuss: After everyone has had a chance to be the robot, bring the class back together to discuss their experience. In particular, discuss as a class:

  • What was the most difficult part of coming up with the instructions?
  • Did anyone find a bug in your instructions once your robot was following them?
    • What was the bug?
    • Why do you think you didn't notice it when writing the program?
  • When you were the robot, what was the hardest part of following the instructions you were given?

Wrap Up (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?
  • How did you feel during today’s lesson?
  • Draw a stack of cups that the robot made today.
  • Draw a stack of cups that you would like a robot to make someday!

Standards Alignment

View full course alignment

CSTA K-12 Computer Science Standards

AP - Algorithms & Programming
  • 1B-AP-11 - Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process.

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
  • 4.L.6 - Acquire and use accurately grade-appropriate general academic and domain-specific words and phrases, including those that signal precise actions, emotions, or states of being (e.g., quizzed, whined, stammered) and that are basic to a particular topic (e.g
SL - Speaking & Listening
  • 4.SL.1 - Engage effectively in a range of collaborative discussions (one-on-one, in groups, and teacher-led) with diverse partners on grade 4 topics and texts, building on others’ ideas and expressing their own clearly.
  • 4.SL.1.b - Follow agreed-upon rules for discussions and carry out assigned roles.
  • 4.SL.1.c - Pose and respond to specific questions to clarify or follow up on information, and make comments that contribute to the discussion and link to the remarks of others.
  • 4.SL.6 - Differentiate between contexts that call for formal English (e.g., presenting ideas) and situations where informal discourse is appropriate (e.g., small-group discussion); use formal English when appropriate to task and situation.

Common Core Math Standards

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
  • 3-5-ETS1-1 - Define a simple design problem reflecting a need or a want that includes specified criteria for success and constraints on materials, time, or cost.
  • 3-5-ETS1-3 - Plan and carry out fair tests in which variables are controlled and failure points are considered to identify aspects of a model or prototype that can be improved.