# Lesson 9: Drawing Gardens with Loops

## Overview

Returning to loops, students learn to draw images by looping simple sequences of instructions. In the previous online lesson, loops were used to traverse a maze and collect treasure. Here, students use loops to create patterns. At the end of this stage, students will be given the opportunity to create their own images using loops.

## Purpose

This lesson gives a different perspective on how loops can create things in programming. Students will test their critical thinking skills by evaluating given code and determining what needs to be added in order to solve the puzzle. Students can also reflect on the inefficiency of programming without loops here because of how many blocks the program would require without the help of `repeat` loops.

## Objectives

### Students will be able to:

• Count the number of times an action should be repeated and represent it as a loop.
• Decompose a shape into its largest repeatable sequence.
• Create a program that draws complex shapes by repeating simple sequences.

## Preparation

• Play through the puzzles before the lesson to find any potential problem areas for your class.
• Review CS Fundamentals Main Activity Tips - Lesson Recommendations.
• Make sure each student has a Think Spot Journal - Reflection Journal.

## Vocabulary

• Loop - The action of doing something over and over again.

# Teaching Guide

## Warm Up (10 min)

### Introduction

• Quickly review the definition of a loop, the action of doing something over and over again.
• Discuss different patterns like zigzags and stairsteps.
• How would you explain to someone how to draw that pattern?
• How could you draw this using a loop?

In the artist levels, students will be using 45 degree angles described as northwest, northeast, southwest, southeast. We recommend briefly discussing these directions with the class and drawing an image for students to refer back to.

## Main Activity (30 min)

### Online Puzzles

#### Teacher Demonstration

Teacher Tip

Remind the students to only share their work with their close friends or family. For more information watch or show the class Pause and Think Online - Video.

We've included some multiple choice prediction levels that are difficult for non-readers. These levels are optional for you to review with your class to help prepare for the puzzles to come. Alternatively, these could be used after finishing the stage as a review for the class.

Prediction Levels:

## 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 the patterns you made with a loop.
• Draw a pattern that you would like to make with a loop.
• The Artist in Code Studio
• 1
• (click tabs to see student view)
View on Code Studio

### Student Instructions

• Practice
• 2
• (click tabs to see student view)
View on Code Studio

### Student Instructions

This is a new type of puzzle called "Artist". Play with the level and draw something fun.

• Repeat Blocks with the Artist
• 3
• (click tabs to see student view)
View on Code Studio

### Student Instructions

View on Code Studio

### Student Instructions

The Artist is trying to draw a line 6 times, but can't get it right. Can you help?

View on Code Studio

### Student Instructions

Help the artist draw a line 7 times to make a garden wall.

View on Code Studio

### Student Instructions

Now we need to get the soil ready to plant. Find the bugs in the code and help the artist prepare the ground.

View on Code Studio

### Student Instructions

Time to fix the stairs! Repeat this pattern 5 times so the artist can reach the top of the bushes.

View on Code Studio

### Student Instructions

Behind the bushes there is a beautiful vine full of flowers. Can you climb the vine and see where it goes?

• Challenge
• 9
• (click tabs to see student view)
View on Code Studio

### Student Instructions

Challenge: It's a hidden garden! Let's walk around.

• Practice
• 10
• 11
• (click tabs to see student view)
View on Code Studio

### Student Instructions

Time to head home. Can you fix this ladder using only one block to help the artist get down?

View on Code Studio

### Student Instructions

Let's take the short way home, over the pond. Can you help the artist stay on the stones?

• Free Play
• 12
• (click tabs to see student view)
View on Code Studio

Teaching Tip

This is a free-play level. This is not only a great place to point students who are progressing quickly, but a place for all students to really express their creativity. While students are not actually required to write any code in this level, doing so will allow them to apply what they have learned in a way that is more meaningful to them. Encourage your students to take their time here. These levels are not checked for correctness to allow for more open-ended creativity. Empower your students to determine for themselves when they have created something they like. There is no one right answer! Example solutions are available for this level which can be viewed by opening the teacher panel to the right.

### Student Instructions

Use what you have learned to draw a picture of what you think the artist saw when he got home.

### Ideas

View on Code Studio

### Student Instructions

"It's time to toss the dice! Can you help me draw these?"

View on Code Studio

### Student Instructions

Draw as many X's as you can. Can you get 3 in a row?

## Standards 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-10 - Develop programs with sequences and simple loops, to express ideas or address a problem.
• 1A-AP-11 - Decompose (break down) the steps needed to solve a problem into a precise sequence of instructions.
• 1A-AP-14 - Debug (identify and fix) errors in an algorithm or program that includes sequences and simple loops.