Football fans across the country will be astounded by the intricate” card stunts” performed by audience members as college bowl season approaches, in addition to the on-field action. The highly-coordinated crowd work is able to create intricate images that closely resemble the pixelated images on computer screens and are similarly coded.
Similar examples of how the machines around us function and how we should n’t be suspicious of an automaton-filled future as long as we learn their language ( at least until they finish learning ours ) can be found in Michael Littman’s most recent book, Code to Joy: Why Everyone Should Learn a Little Programming. For beginning programmers of all ages, Code to Joy offers an approachable and enjoyable guide to the fundamentals of programming, from sequencing commands to storing variables.
Excerpted from Code to Joy: Why Everyone Should Learn a Little Programming by Michael L Littman. Published byMIT Press. Copyright © 2023 by Michael L Littman. All rights reserved.
” GIMME A BLUE”
Card stunts are similar to flash mobs in that the participants do n’t require any special abilities and can even practice in advance. They involve holding up colored signs to create a massive, temporary billboard. They only need to appear and adhere to brief command sequence instructions. The instructions tell a stunt leader to hold the appropriate poster-sized colored cards aloft at the proper time. Following the instructions is the first step in a typical set of card-stunt instructions:
-
Pay close attention to instructions.
-
Hold the card’s top level ( not above your head ) at eye level.
-
Hold the color you want to the field ( away from you ).
-
When a stunt is finished, pass the cards to the aisle ( do n’t tear them up ).
Even though these instructions should be obvious, failing to follow them will undoubtedly result in disaster. However, you can be sure that a wise alec will enquire later,” Sorry, what was that first one again?” Without a doubt, I would do that.
The main event then occurs, which may be the command sequence for one particular person in the crowd:
-
Blue
-
Blue
-
Blue
No, taking a breath? You might need to consider the bigger picture, though. The concept of card stunts as a whole makes use of the grid-like seating arrangement used by spectators in stadiums. They resemble a large computer display screen by holding up colored rectangular signboards. Each participant serves as a single image element—pixels! The image is altered or even transformed into a larger-than-life animated gif during shifts in which cards are being held up.
In the 1920s, crowd participation in college sports led to the development of card stunts. When it was generally agreed that everyone should do their own thing, man, they lost a lot of their appeal. However, there was a genuine desire to develop ever-more elaborate displays in the 1950s. For each of the 1,000 seats, cheer squads would manually design the stunts and then write out specific instructions. To put that much effort into your team, you must truly love them. In the 1960s, a few schools created programs to transform sequences of hand-drawn images into individualized instructions for each participant because they believed that those cutting-edge computer tools might be useful for removing some of the tediousness from the preparation of instruction. People could create much richer, more personalized sequences for each individual pixel with the aid of computers, which would instruct them on when to lift a card, what color to do so, and whether to put it down or switch to another card. Therefore, this example is about the computer creating command sequences for people to follow, as opposed to the questionnaire example from the previous section. Additionally, more complex stunts can be made thanks to computer support for automating the creation of command sequences. As a result, the participant’s command sequence looked like:
-
On 001 white, up
-
Blue 003
-
White 005
-
Red 006
-
White 008
-
Blue 013
-
White 015
-
001 down
-
022 White is up.
-
0 down, 035
-
036 White is up.
-
Blue 043
-
044- down
-
045 White is up.
-
metallic red ( 057 )
-
0 down, 070
Okay, reading the instructions is still more enjoyable than viewing the finished product; in this case, it’s a portion of an animated Stanford” S.” An announcer in the stadium calls out the step number (” Forty-one” ) to synchronize these commands. Each participant can then determine what to do by following their instructions, such as” I’m still holding up the white card I lifted on the 36th, but when the count reaches 43, I’ll be getting ready to swap it for a blue card.”
A card stunt is n’t particularly difficult for people to participate in, but it’s a pretty cool illustration of how to create and execute command sequences where the computer directs our actions rather than the other way around. And despite how simple it may seem, mistakes can still occur. Hillary Clinton’s supporters prepared an arena-wide card stunt for the 2016 Democratic National Convention. Some attendees were reluctant to take part despite the fact that it was meant to be a patriotic show of unity. The end result was a confusing mess that depressingly purported to spell” Stronger Together.”
Nowadays, turning a photograph into instructions on which colors to hold up where is made simple by computers. In essence, the combination of red, blue, and green that should be displayed at each picture position is already specified in any digitized image. The fact that most images are made up of millions of colored dots ( megapixels ), whereas a stadium’s card stunt section may have 1,000 seats, presents an interesting challenge when translating an image into card-twist instructions. It makes more sense to calculate the average of the colors in that portion of an image rather than asking each person to hold up a thousand tiny cards. The computer then chooses the color that is most similar to the average from among the available options ( let’s say, the standard sixty-four Crayola options ).
It’s not immediately clear how a computer can average colors, if you think about it. How do you teach a machine to mix green and yellow so that the end result resembles the spring green crayon? Let’s take a closer look at this query. You’ll learn more about how computers can assist us in better instructing them as a result. Additionally, it will mark our entry into the fascinating machine learning world.
Actually, there are a ton of different ways to average colors. The ability to use the amount of red, green, and blue color contained in each dot of color in an image file is a straightforward one. The largest value you can create with eight binary digits, or bits, is 255, which is how each component color is represented as a whole number between 0 and. Because the color receptors in the human eye convert real-world colors into this representation, using large amounts of red, blue, and green works well. In other words, despite the fact that purple is associated with a particular light wavelength, our eyes perceive it as an unusual combination of red, blue, and green. Someone will see purple if you show them the same blend. Therefore, to sum up a large group of pixels, simply average the proportions of blue, red, and green. That essentially functions. Now, it turns out that square rooting the values after averaging and squaring them before the average produce better results for both physical, perceptual, and engineering reasons. However, that is unimportant at this time. The fact that a group of colored dots can be mechanically averaged to produce one dot whose color best describes the group is what matters.
The computer needs a method for determining the closest color to the cards we have available once that average color has been produced. Which is more red-orange or burnt sienna-like? The Euclidean distance formula is a typical ( if imperfect ) method of estimating how similar two colors are using their red, blue, and green values. Here is a command sequence that resembles that:
-
Consider the square root of the difference in red between the two colors.
-
Consider the squared difference between the two colors ‘ levels of blue.
-
Add the three squares together to determine the difference in green content between the two colors.
-
the square root
Therefore, simply determine which of the available colors ( blue, yellow green, apricot, timberwolf, mahogany, and periwinkle, etc. ) should be held up to best capture the average of colors in the corresponding portion of an image. has the shortest separation from that local average color. The pixel person seated in that location in the grid should receive a card with that color on it.
I’m fairly certain that the similarity between the color averaging operation and this distance calculation is merely coincidental. A square root can occasionally be nothing more than that.
In order to build the command sequence for a card stunt, we can use these operations—color average and finding the color that is closest to the average—in the reverse direction. A map of which color card should be held up in each seat to best reproduce the image is produced by the computer using the target image, seating chart, and a set of available color cards as input. In this instance, the computer primarily handles bookkeeping and is n’t involved in much decision-making other than choosing the closest color. However, the end result is that writing command sequences is becoming more and more labor-intensive for the computer. In the card stunt, we no longer have to choose every command for each individual pixel at every stage; instead, the computer now generates the required commands when we choose images.
This change in perspective makes it possible to give the machine more control over the command-sequence generation process. We can transition from telling ( giving explicit instructions ) to explaining ( providing explicit incentives ) using our 2 2 grid from chapter 1. For instance, this color selection problem has a different variation that is much more challenging and requires more work from the computer. Imagine that we could print cards in any color we desired, but our print shop requires bulk ordering. We only have eight card colors available to us, but we can mix and match any of them. ( Eight different values can be created with three bits because bits are important in computing. ) In order to create a stunning ocean wave in eight different shades of blue, we could choose from the hues cerulean, indigo, cadet, and sky blue. Wonderful!
However, there would n’t be any red or yellow to create other images. It may seem strange to limit the color palette to eight, but early computer monitors actually functioned exactly that way. Only eight different colors could be displayed at once on the screen out of the millions that are available.
This restriction makes it much more difficult to render an image in colored cards. In addition to choosing which color from our collection of color options will be used to create each card, you must also choose which eight colors will make up that collection. A variety of skin tones will be much more helpful when creating a face than separating between green and blue hues. How do we reduce the list of colors that will make up our set of color options from the ones we wish we could use because they are in the target image?
This color-choice issue can be resolved for us using machine learning, specifically an approach called clustering or unsupervised learning. I’ll explain how. But first, let’s examine a connected issue that arises from creating jigsaw puzzles out of faces. We’re going to have the computer create a series of commands for rendering images, just like in the card-stunt example. The puzzle pieces that can be used to create the picture are fixed in advance, which adds a twist. It will employ the same set of commands and take into account which sequence results in the desired image, much like the dance-step example.