Lesson 6: Programming in Maze

Algorithms | Debugging | Program | Programming

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 (5 min)

Bridging Activity - Choose One (10 min)

Previewing Online Puzzles as a Class (3 min)

Main Activity (30 min)

Wrap Up (5 - 10 min)

Extended Learning

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 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.
  • Program - An algorithm that has been coded into something that can be run by a machine.
  • Programming - The art of creating a program.

Support

Report a Bug

Teaching Guide

Warm Up (5 min)

Teaching Tip

If your class has already learned cardinal directions, then changing "Up" and "Down" to "North" and "South" shouldn't be a problem. If they have not, we have provided a handy worksheet with the Code.org Compass Rose that you can use to get students onboard. This conversion will come in handy for nearly all of the online puzzles aimed at kindergarten and first grade.

Let students know that they will see those letters in their online programs next to the direction arrows.

Review Unplugged Activity

This lesson relies on many of the unplugged ideas that students have learned in the weeks leading up to this first online activity. It is important that you bring those concepts (such as persistence, debugging, algorithms, and programs) around full-circle so that your class can benefit from them in their online work as well.

Display: Show students a picture from the "Happy Maps" exercise that you completed in the lessons prior to this one.

Discuss: Ask students to recall the symbols used in "Happy Maps."

  • What would the Flurb do when you used the "North" arrow?
  • How about the "East" arrow?

Blend in some context from the story "Unspotted Bugs" as well.

  • What would happen if we made a mistake when programming the Flurb? What if there was a "bug" in our program? Would we throw the whole thing away and start over?

Encourage students to think about the tips:

  • Was everything right at the first step?
  • How about the second?
  • Where did it go wrong?

Transition: Once you are satisfied that your students remember "Happy Maps" and "Unspotted Bugs", you can move into the Bridging Activity.

Bridging Activity - Choose One (10 min)

This activity will help bring the unplugged concepts from Happy Maps into the online world that the students are moving into. Choose one of the following to do with your class:

Unplugged Activity Using Paper Blocks

Distribute: Give students Unplugged Blockly Blocks (Grades K-1) - Manipulatives with cardinal commands like E → (East) and W ← (West).

Display: Choose an empty Flurb map from the Happy Map Cards - Worksheet and display it for the class to see.

Model: Starting at the location of the Flurb, use your finger to show students what each block does. Show them how the E → corresponds to the right arrow and moves the Flurb one step to the right. Do the same for each of the other three.

Think: By this point, the class should know how to get the Flurb to the fruit using arrows. How would you get the Flurb to the fruit using Blockly blocks?

Pair: Now, have the students program the Flurb from their desks using the paper Blockly blocks. Make sure that they understand that the blocks need to go from top to bottom and they all need to be connected!

Share: Have pairs discuss their answers with elbow partners. Did everybody get the same thing?

Online Puzzles using Arrows

Display: Show students a the playspace from one of the puzzles corresponding to this lesson. We recommend puzzle 8.

Think: Ask students to imagine that this puzzle is just like the Flurbs and the fruit, but instead, it's a bird trying to get to the pig. How can they write a program to get the bird to the pig using arrows?

Pair: Using just the symbols from the Happy Map Game Pieces - Manipulatives, have students lay out a pattern that they think will get the bird to the pig.

Share: Ask the students to share their answers with the class. Did anyone else have the same answer?

Previewing Online Puzzles as a Class (3 min)

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

Model: Pull up Puzzle 8 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 the issues into ideas that they've seen in previous lessons, such as what to do when a program doesn't work (Debug it!) or how to get through the frustration that can come with working on a computer.

Next, you'll need to describe how the blocks in the workspace move the bird toward the pig. Show students how to drag blocks from the toolbox and connect them beneath the when run block, but don't solve the puzzle.

Discuss: Think about how we would get the bird to the pig using arrows. How do we use these blocks instead?

Have students use their fingers to point the direction that the bird should go next. Once you feel like you have a classroom consensus, try to get students to put into words which block will make that action happen. Roll your mouse over different options and have them shout "Yes" or "No".

Drag blocks into place one at a time, then click "Run" after each one. This will not only let them see how far the bird has gone, but set good habits for when they start working to solve their own puzzles.

Continue this pattern, fixing bugs as they arise, until the bird successfully gets to the pig.

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)

Additional Demonstration

We've included some multiple choice prediction levels that are difficult for non-readers. Alternatively, these could be used after finishing the stage as a review for the class.

Prediction Levels:

Course A Online Puzzles - Website

Teacher Tip:

Show the students the right way to help classmates by:

  • Don't sit in their chair
  • Don't use their keyboard
  • Don't touch their mouse
  • Make sure the classmate can describe the solution 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?
  • Draw one of the Feeling Faces - Emotion Images that shows how you felt about today's lesson in the corner of your journal page.
  • Draw something that you shouldn't do while helping a friend with a Code.org puzzle

Extended Learning

In small groups, let students design their own mazes on paper and challenge other students or groups 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

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