Painting With Loops

Unplugged Activity

For this activity assumes the paintbrush starts at the Top Left Corner. The code is made up of arrows denoting the movement of the brush, and a square denoting that wherever the brush is hovering over should be filled in.

The first code should paint a diagonal line going from to left to bottom right. How to write the code for the other 2. The students will be given a chance to fill in their own code and patterns to gain a deeper understanding and to challenge others.

Encourage use of patterns utilizing repetition/loops in the code.

Loops

Let's look at the sequence for drawing a square from scratch:

Do you recognize any pattern here?

Is anything repeating over and over?

When you find patterns that repeat you can use Loops to simplify your code, so that the above becomes:

Practice