Lesson 2: Programming in Maze

Overview

Using characters from the game Angry Birds, students will develop sequential algorithms to move a bird from one side of a maze to the pig at the other side. To do this they will stack code blocks together in a linear sequence, making them move straight, turn left, or turn right.

Purpose

In this lesson, students will develop programming and debugging skills on a computer platform. The block-based format of these puzzles help students learn about sequence and concepts, without having to worry about perfecting syntax.

Agenda

Warm Up (4 min)

Bridging Activity - Programming (10 min)

Previewing Online Puzzles as a Class (3 min)

Main Activity (30 min)

Wrap Up (5 - 10 min)

Extended Learning

View on Code Studio

Objectives

Students will be able to:

  • Translate movements into a series of commands.
  • Identify and locate bugs in a program.

Preparation

Links

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

For the Teachers

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.
  • Sequencing - Putting commands in correct order so computers can read the commands.

Support

Report a Bug

Teaching Guide

Warm Up (4 min)

Review Unplugged Activity

This lesson relies on many of the ideas that students learned while struggling with the "Building a Foundation" activity. It is important that you bring those concepts (such as persistence and debugging) around full-circle so that your class can benefit from them in their online work as well.

Display: Show students pictures of the "Building a Foundation" activity that you completed in the lessons prior to this one.

Discuss: Ask students why you put them through the challenging experience of creating a structure with hard rules.

  • Do you remember any of the ideas that we learned?
  • Persistence, Frustration, Debugging
  • When you make a mistake, are you supposed to just give up? Do you throw everything away and start over?

Transition: Once you are satisfied that your students remember "Building a Foundation", you can move into the Bridging Activity.

Bridging Activity - Programming (10 min)

Transitioning from Unplugged to Online

This short activity will help students relate the ideas of persistence and debugging to the puzzles that they are about to complete online.

Display: Project a copy of the Course C, Lesson 2 Maze Bridging Page - Puzzle Manipulative (PDF) for the class to see. Make sure that you have pre-placed the movement blocks in the workspace using Unplugged Maze Blocks - Manipulatives in a configuration like the one below:

Model: Tell students that you have this workspace on display that looks just like the area that they will see when they start to do the Code.org puzzles online. As the teacher, let them know that you are SO SMART that you already put all of the code in that you are going to need to solve this puzzle, then ask them to watch you "Run" it by moving your finger (or a penny, or some other indicator) along the path.

It won't be long before you run into a block of TNT. Feign frustration.

Discuss: - What am I feeling right now, do you think? - Should I quit? - Should I throw all of the code away and start over?

Think: How can I fix this program so that I don't run into the TNT?

Pair: Have students work on solutions to get the bird around the TNT. Depending on your classroom, you might want to either have them fix each mistake one at a time (with demos in between) or students might feel comfortable working together to fix the entire program.

Share: Have volunteers come up to help move the blocks into the right location. "Run" the program over and over as a class, fixing bugs, until the bird does what it is supposed to. Continue to point out experiences that relate to persistence, frustration, and debugging.

When your class reaches the pig, celebrate not only their achievements, but their persistence!

Previewing Online Puzzles as a Class (3 min)

Students should now be ready to see a real puzzle in action!

Lesson Tip

Some students may struggle with turning their bird in the correct direction, particularly when the bird isn't facing up. Remind students that when we say turn left or right, we're giving directions from the bird's point of view.

Model: Pull up Lesson 2, Puzzle 5 to do in front of the class. This will be the same puzzle that they just saw in the bridging activity. While working through this puzzle with the class, remind students that making mistakes is okay and remind them that the only way to be successful is to be persistent. Tie the limitations of the online puzzles into the limitations that students were facing with "Building a Foundation". (When completeing "Building a Foundation", you only had x toothpicks and y gumdrops. Here, you only have 3 move forward blocks and 2 turn blocks.) Remind them that finding the solution might be harder with limitations, but that you believe in them.

Discuss: Does anyone remember how to solve this puzzle?

As the teacher, you should decide if you will have the students remind you how to solve it from their seats, or come to the computer to drag the actual blocks in one-by-one.

Transition: Now that students have seen an online puzzle in practice, they should be ready to start solving puzzles of their own. Continue to the lab or bring out their classroom machines.

Main Activity (30 min)

Course C Online Puzzles - Website

Teacher Tip:

Show the students the right way to help classmates:

  • 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 during the activity.
  • 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.

Discuss: After providing students with end-of-class warnings, grab everyone's attention and get them to reflect on the experiences that they just had.

  • Did anyone feel frustrated during any of the puzzles?
  • Did anyone notice the need to be persistent?

Transition: Have students grab their Thinkspot Journals and take a moment to leave lessons for themselves.

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?
  • How did you feel during today’s lesson?
  • Draw an activity you like to do that you struggled with the first time. Draw or describe how you got better.

Extended Learning

Use these activities to enhance student learning. They can be used as outside of class activities or other enrichment.

Create Your Own

In small groups, let students design their own mazes and challenge each other to write programs to solve them. For added fun, make life-size mazes with students as the pig and bird.

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-11 - Decompose (break down) the steps needed to solve a problem into a precise sequence of instructions.

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
  • 2.L.6 - Use words and phrases acquired through conversations, reading and being read to, and responding to texts, including using adjectives and adverbs to describe (e.g., When other kids are happy that makes me happy).
SL - Speaking & Listening
  • 2.SL.1 - Participate in collaborative conversations with diverse partners about grade 2 topics and texts with peers and adults in small and larger groups.

Common Core Math Standards

G - Geometry
  • 2.G.2 - Partition a rectangle into rows and columns of same-size squares and count to find the total number of them.
MP - Math Practices
  • MP.1 - Make sense of problems and persevere in solving them
  • 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
OA - Operations And Algebraic Thinking
  • 2.OA.1 - Use addition and subtraction within 100 to solve one- and two-step word problems involving situations of adding to, taking from, putting together, taking apart, and comparing, with unknowns in all positions, e.g., by using drawings and equations with a sy

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.