Minds On

Repeating song lyrics

Explore the following song and consider these questions:

  • Which parts of the song repeat?
  • How many times does each part of the song repeat?

Head, shoulders, knees, and toes,

Knees and toes.

Head, shoulders, knees, and toes,

Knees and toes.

And eyes and, ears and, mouth, and nose.

Head, shoulders, knees, and toes,

Knees and toes.

By counting the number of times something repeats, we don’t have to always write each part over and over again. We can just indicate what part repeats and for how many times.

Brainstorm

Brainstorm

Now, think of other songs that have lines that are repeated. How many can you come up with?

Action

Coding on a grid

A robotic bug named RB1 came with a manual explaining that it can do the following actions:

Movement

Symbol

Forward

Fwd

Right Quarter Turn

RT

Left Quarter Turn

LT

A pen is attached to the robotic bug. The robotic bug also comes with a large whiteboard grid. As it moves, it draws a path on the grid, which shows us its movement.

Let’s place the robotic bug as demonstrated in the following board.

An 8-by-8 grid. A bug is in the top left square, facing down, and the words ‘Starting position’ above.

Now let’s imagine that the following line of code is entered into the robotic bug:

Fwd 4, LT, Fwd 4, LT

This demonstrates sequential events because one instruction is completed after another.

The robotic bug draws the following shape on the grid and ends up in the following position:

An 8 by 8 grid. The bug has moved from the top left square to the 5th row, 5th column.

Indicate what instructions in the code are repeated and how many times these instructions are repeated. Press the ‘Hint’ button to reveal a suggested answer.

The Fwd 4, LT instructions are repeated two times.

Instead of writing out these instructions twice, you can use something called ‘repeat.’ This requires less lines of code, and now you’re just telling the computer to do the same action multiple times.

Using ‘repeat’

Let’s place the robotic bug back onto the same starting position as before.

The following line of code is entered into the robotic bug:

Repeat 2 [Fwd 4, LT]

What do you think this new line of code will make the robotic bug do? Press the ‘Hint’ button to check your answer.

It would create the same “L” shape as when we used the instructions: Fwd 4, LT, Fwd 4, LT.

What’s the code?

The bug is now put back on the starting position. For this task, you will try to explain the movement of the robotic bug, as shown in the following images, by writing them out in code! Try to use repeats whenever possible. For each of the following examples, the robotic bug will always start in the top left square.

Complete the Robotic Bug Grids Activity in your notebook or using the following fillable and printable document. You can also use a method of your choice.

Robotic Bug Grids

Press the ‘Activity’ button to access Robotic Bug Grids.

Activity (Open PDF in a new tab)

1) What is the possible code to draw this image?

An 8 by 8 grid. Bug moves south 4 spaces, east 4 spaces, north 4 spaces, then west 4 spaces.

2) What is the possible code to draw this image?

An 8 by grid. Bug moves south 4 spaces, east 4 spaces, north 4 spaces, east 2 spaces, south 2 spaces, then west 2 spaces.

Check your work

Let’s make sure we found the correct code! Press the ‘Reveal’ button to check your work.

  1. Repeat 4 [Fwd 4, LT]
  2. Repeat 3 [Fwd 4, LT], Repeat 2 [RT], Repeat 3 [Fwd 2, RT]

Reflection questions

Record your thoughts to the following questions using a voice recorder, speech-to-text, or writing tool.

  1. Were your code solutions the same as the sample answers? Similar? Different?
  2. How were they different?
  3. Did you need to adjust your code, or was your code a different way of drawing the same image?

Create your own code

For this activity, you will write a series of code to make the robotic bug move on a grid in any shape you choose. The code should have a minimum of four steps and be sure to use at least one repeat! Could someone else figure out what the robotic bug will draw by looking at your code?

Complete the Your Robotic Bug Grid Activity in your notebook or using the following fillable and printable document. You can also use a method of your choice.

Your Robotic Bug Grid

Press the Activity button to access the Your Robotic Bug Grid.

Activity(Opens in a new tab)

Consolidation

Which code made the drawing?

Examine the following drawing created by the Robotic Bug. Which code do you believe was used to create this drawing? Select the correct answer.

Now that you have selected the answer, justify your selection. Record your answer using a method of your choice.

Reflection

As you read through these descriptions, which sentence best describes how you are feeling about your understanding of this learning activity? Press the button that is beside this sentence.

I feel...

Now, record your ideas using a voice recorder, speech-to-text, or writing tool.