Random Acts of Computational Thinking: Pattern Recognition

Randomness is powerful. It can be harnessed for creative endeavors, which can in turn be transformed into learning experiences. A past post from this blog, for example, suggested using random functions in Wolfram Language to inspire brainstorming for NaNoWriMo, a creativity-fueled writing challenge.

Creativity is enlivened by randomness, as randomization often involves generative processes. Producing a list of random words suggests connections between them, just as pictures can be found in the random shapes of clouds while cloud-watching. In this sense, pattern recognition is not just a technological process.

Fluffy clouds shrouded in shadow
Photo by Joshua Reddekopp on Unsplash

This post is the first in a series of “random acts” to help teach you about computational thinking. Each post will share a single randomized function and connect it to a topic like pattern recognition, decomposition and more. Hopefully they inspire your own creativity!

Exploring Pattern Recognition through RandomColor

The function RandomColor is a function that displays, as expected, randomized color blocks. You can add a number between the brackets to generate a certain number of colors. For example, RandomColor[2] displays two colors.

Screenshot of RandomColor function with two in brackets. Colors are light teal and brown.

By displaying more than one color, the code invites the viewer to consider what the colors have in common. This involves grouping. In turn, the order of those commonalities becomes a pattern, an organization. A red color, a blue color, then another red color is a pattern of alternating warm and cold colors.

Screenshot of RandomColor function with three in brackets. Colors are blue, blue-green, and teal.

Is there a trend? What might come next in the previous output? (My bet is a light green.)

This function produces a number of colors in a random order, but you can take things further by having students create their own patterns. For example, here is a RandomColor “palette”:

Screenshot of RandomColor function with six in brackets. Colors are green-blue, yellow, red, purple-blue, warm green, and blue.

There are different pattern options, from arranging by temperature, in certain intervals or even by an idiosyncratic pattern. Depending on your students’ level, they can add to the complexity. There doesn’t have to be a “correct” answer.

Why Pattern Recognition?

Pattern recognition is an early learned skill, be it recognizing patterns in grammar or evens and odds in math. Patterns can use various sensory inputs, although they’re often thought of as visual. What is a secret knock but a pattern?

Pattern recognition is an important part of computational thinking. It can help students begin the process of abstraction, for example. When object-oriented code is involved, grouping like items can help to build classes. The pattern can then be used to either generate new members of that group or create functions.

RandomColor provides a way to explore the idea of pattern recognition that doesn’t have to rely on numeracy or semantics (though it can). It is visual, but it complements other pattern-recognition tasks. Maybe the random colors could then fuel a class art project!

About the blogger:

Photo of a smiling woman with brown hair and glasses, surrounded by a blue circle

Jesika Brooks

Jesika Brooks is an editor and bookworm with a Master of Library and Information Science degree. A lifelong learner herself, she has always been fascinated by the intersection of education and technology. She edits the Tech-Based Teaching blog (and always wants to hear from new voices!).

--

--

Tech-Based Teaching Editor
Tech-Based Teaching: Computational Thinking in the Classroom

Tech-Based Teaching is all about computational thinking, edtech, and the ways that tech enriches learning. Want to contribute? Reach out to edutech@wolfram.com.