Create an algorithm to color in a paper patchwork quilt.
Adapted from step one of the Brownie Coding Basics badge.
Learn: Computers may seem really smart because they can do lots of things for us. But computers can only do things they’re told to do using a special language called code.
For example, a computer scientist can create a list of steps for a robot. The robot follows the steps to do anything from moving through a maze to doing surgery. A list of steps to complete a task is called an algorithm.
Once you know what an algorithm is, you can then write or follow one to complete any type of task!
Time needed: 20 minutes
- 3+ markers of different colors
- 1 pencil
- A few sheets of blank paper
To get started, create a 5x5 grid on a blank sheet of paper. Your grid can be as large as the paper, and it’s okay if the boxes are rectangular.
After that, design your quilt pattern by coloring in the blank grid with the different colored markers.
Once you’ve created the pattern, write an algorithm to tell someone else how to create your quilt!
Make sure to use a new numbered line for each row on your quilt. On each line, write the colors for each patch in the order, or sequence, you colored them, from left to right.
For example: Line 4: Blue, Green, Purple, Green, Blue
After you write your algorithm, test it by following the steps to color in a new grid. Make another blank 5x5 grid and color it in according to your algorithm.
How did you do? Does the new quilt match your original design? If not, that’s okay! This often happens to computer scientists!
In computer science, a problem or error in your code is called a bug. When you find and fix a bug, it's called debugging. When programmers find a bug, they go back to their algorithm, find the problem, and fix it.
If you get stuck or your algorithm doesn't work, you can always work with others to talk it out, identify the bug, and sketch a new plan to find a solution that works.
Remember, it's okay if your algorithm doesn't go the way you want it to on the first, second, or even third try! Computer scientists persevere and continue to try and solve the problem even when they're faced with big challenges. When you persevere, you don't give up. Instead, you do your best and work towards a goal, even if it's a big challenge.