Lesson 14: Until Loops in Maze

Overview

In this lesson, students will learn about until loops. Students will build programs that have the main character repeat actions until they reach their desired stopping point.

Purpose

This set of puzzles will work to solidify and build on the knowledge of loops by adding the until conditional. By pairing these concepts together, students will be able to explore the potential for creating complex and innovative programs.

Agenda

Warm Up (10 min)

Bridging Activity (15 min)

Main Activity (30 min)

Wrap Up (15 min)

View on Code Studio

Objectives

Students will be able to:

  • Build programs with the understanding of multiple strategies to implement conditionals.
  • Translate spoken language conditional statements and loops into a program.

Preparation

Links

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

For the Students

Vocabulary

  • Condition - Something a program checks to see if it is true before allowing an action.
  • Conditionals - Statements that only run under certain conditions.
  • Loop - The action of doing something over and over again.
  • Repeat - To do something again.
  • Until - A command that tells you to do something only up to the point that something becomes true.

Support

Report a Bug

Teaching Guide

Warm Up (10 min)

Introduction

In this lesson, students will be creating loops that only run until a condition is true. Help the students understand how this works by leading them in group activities and having them do an action until some condition is true. For example: Have students touch their nose until you tell them to stop.

Bridging Activity (15 min)

Preview of Online Puzzles

Pull up a puzzle. We recommend Puzzle 4.

  • Ask the class what the bird should repeat to get to the pig.
  • Ask the class what they can use to repeat this code.
    • The bird should repeat this pattern until it reaches the pig.

Fill in the rest of the code using the repeat until loop and press Run. Discuss with the class why this worked.

Main Activity (30 min)

Online Puzzles

Bringing together concepts is not easy, but this set of lessons is meant to help students see the endless possibilities of coding when using conditions. If students struggle at all with understanding the similarities or differences between while loops and until loops, have them try to think of how they would use similar statements in their real lives.

Wrap Up (15 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 do you feel about today's lesson?
  • What's the difference between an until loop and a while loop?
View on Code Studio

Student Instructions

"Hi, I'm a farmer. I need your help to flatten the field on my farm so it's ready for planting!"

Move to the pile of dirt and use the remove block to remove it.

View on Code Studio

Student Instructions

View on Code Studio

Student Instructions

"Move to the pile of dirt and tell me how many shovelfuls to remove."

Use as few blocks as possible to solve this puzzle.

View on Code Studio

Student Instructions

Look closely at the code below. What will happen after you click "Run"?

Nothing will happen.

The farmer will never stop removing dirt.

The farmer will remove dirt as long as there is a pile, then stop when the pile is gone.

I don't know.

View on Code Studio

Student Instructions

"I don't know how much dirt is in this pile!"

Help the farmer remove this entire pile using a while loop.

View on Code Studio

Student Instructions

View on Code Studio

Student Instructions

Look at all of those holes! Each one needs a different amount of dirt.

You can use the while loop to easily fill them all!

View on Code Studio

Student Instructions

View on Code Studio

Student Instructions

Challenge: Fill all of these holes using as few blocks as possible.

View on Code Studio

Student Instructions

View on Code Studio

Student Instructions

View on Code Studio

Student Instructions

Take a good look at the code below. What will be left at the end of this puzzle?

Nothing. This code will leave only level ground.

This code will leave the pile completely untouched.

This code will leave the holes completely untouched.

I don't know.

View on Code Studio

Student Instructions

Fill all of the holes and remove all of the piles.

Standards Alignment

View full course alignment

CSTA K-12 Computer Science Standards (2017)

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
  • 3.L.6 - Acquire and use accurately grade-appropriate conversational, general academic, and domain-specific words and phrases, including those that signal spatial and temporal relationships (e.g., After dinner that night we went looking for them).
SL - Speaking & Listening
  • 3.SL.1 - Engage effectively in a range of collaborative discussions (one-on-one, in groups, and teacher-led) with diverse partners on grade 3 topics and texts, building on others’ ideas and expressing their own clearly.
  • 3.SL.3 - Ask and answer questions about information from a speaker, offering appropriate elaboration and detail.
  • 3.SL.6 - Speak in complete sentences when appropriate to task and situation in order to provide requested detail or clarification.

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.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
OA - Operations And Algebraic Thinking
  • 3.OA.3 - Use multiplication and division within 100 to solve word problems in situations involving equal groups, arrays, and measurement quantities, e.g., by using drawings and equations with a symbol for the unknown number to represent the problem.1

Next Generation Science Standards

ETS - Engineering in the Sciences
ETS1 - Engineering Design
  • 3-5-ETS1-2 - Generate and compare multiple possible solutions to a problem based on how well each is likely to meet the criteria and constraints of the problem.