Lesson 7: 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: The Unplugged Foundation (3 min)

Bridging Activity - Choose One

Online Foundation: Preview Programming in Maze (3 min)

Main Activity (30 min)

Wrap Up (5 - 10 min)

Extended Learning

View on Code Studio

Objectives

Students will be able to:

  • Construct a program by reorganizing sequential movements
  • Build a computer program from a set of written instructions
  • Choose appropriate debugging practices when solving problems

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.
  • 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: The Unplugged Foundation (3 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 cup stack from the "My Robotic Friends" exercise that they completed in the lessons prior to this one.

Discuss: Ask students to recall the symbols used in "My Robotic Friends."

  • What happens when the robot reads 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 Robot? 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 debugging 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 "My Robotic Friends" and "Unspotted Bugs", you can move into the Bridging Activity.

Bridging Activity - Choose One

To connect the unplugged lesson with the upcoming online lesson, choose one of the following activities to do with your class.

1) Unplugged Activity Using Paper Blocks

Model: Select a pattern from resource mrf-cup-stacks-b not found from the My Robotic Friends unplugged activity (if you just modeled an image to review, feel free to keep that one for this portion of the exercise.) Using movement pieces from the Unplugged Blockly Blocks (Grades K-1) - Manipulatives, show students how you would code this structure in this new way.

Pair/Think: Next, choose another pattern and have the students program what blocks a "robot" would need to read to get the correct stacking of those cups.

Make sure that they understand that the blocks need to go from top to bottom and they all need to touch!

Share: Have the students check each other's answers and resolve any questions or bugs that may come up.

2) Online Activity Using Unplugged Arrows

Model: Pull a puzzle from the corresponding online levels. We recommend Lesson 7, Puzzle 8. Show students how to get the bird to the pig using the resource mrf-symbols-b not found. It can be helpful to rename the arrows "North", "South, "East", and "West". Once you have a program, trace it with your finger (or a pointer) and show how the bird will travel when the program is run.

Pair/Think: Next, move back to an easier puzzle, like Lesson 7, Puzzle 7, and have students try writing programs (using arrows) on their own.

Share: Encourage students to share their programs with other groups and see if they came up with solutions that are the same or different. Can anyone come up with another way of getting the bird to the pig?

Online Foundation: Preview Programming in Maze (3 min)

To finish the connection, preview an online puzzle (or two) as a class.

Model: Reveal an entire online puzzle from the progression to come. We recommend Lesson 7, Puzzle 8. Point out the "Play Area" with the bird, as well as the "Work Space" with the Blockly code. Explain that this Blockly code is now the language that students will be using to get the bird to the pig. Do they see any similarities to the exercise that they just did? What are the big differences?

Work with your class to drag code into the workspace in such a way that the bird (eventually) gets to the pig.

Transition: Students should now be ready to transition to computers to complete online puzzles on their own.

Main Activity (30 min)

If you are looking for some extra puzzles to cover with your class, here are some "prediction" puzzles that will allow you to walk through existing code with your students to predict what the bird will do. It is a good idea to cover them together before letting students loose on their own machines.

Prediction Levels:

Course B Online Puzzles - Website

Teacher Tip:

Show the students the right way to help classmates by:

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

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:

  • 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 a bird and a pig somewhere on your paper. Can you write a program to get that bird to that pig?

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

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
OA - Operations And Algebraic Thinking
  • 1.OA.5 - Relate counting to addition and subtraction (e.g., by counting on 2 to add 2).
  • 1.OA.6 - Add and subtract within 20, demonstrating fluency for addition and subtraction within 10. Use strategies such as counting on; making ten (e.g., 8 + 6 = 8 + 2 + 4 = 10 + 4 = 14); decomposing a number leading to a ten (e.g., 13 – 4 = 13 – 3 – 1 = 10 – 1 = 9

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.