10 activities to get kids excited about coding

Teaching your kids to code is just a matter of playing the right games, says Camille McCue.

10 projects that will get kids excited about coding

Lists of ten make perfect sense given that humanity embraces anything ten – ten fingers, ten toes, the Dudley Moore/Bo Derek film (she was the "10," not him), music genre by decade (70s disco, 80s rock), and the terminal "Parts of Ten" chapter in every Dummies tech book.

The number ten also brings back memories of coding tiny BASIC programs on my even tinier Sinclair ZX Spectrum home computer:

20 GOTO 10

With only 4K of RAM, that two-liner was about all my tiny computer could process, but I felt empowered commanding the computer to greet the world in an endless loop.

Getting your kids excited about programming doesn't require parents to know how to code, or even execute any writing of code all – just play some games and then dialogue reflectively on how those games actually work. In doing so, your child will discover underlying principles that form the conceptual basis of coding.

So, try out any or all of these ten coding-inspired activities…

01. Play an old-style arcade game

10 projects that will get kids excited about coding

Feed a few quarters into an old arcade machine to play a retro video game, such as Pac-Man; or play new, arcade-style games online, such as Winter Bells at orisinal.com. Talk about the gameplay, ferreting out the elements that comprise the game and the underlying code.

Ask, "What is the background?" "What are the objects?" "How do objects move and/or shoot?" "How do objects react to the background, and to each other?" "Is there a scoring variable or a lives variable?" "How does the action change over time?"

Deconstructing existing games allows kids to work backwards from finished programs to their component parts – ultimately making construction of new programs a more doable task.

02. Trek your neighborhood

10 projects that will get kids excited about coding

Coding games and simulations involves moving and navigating – and mastering the basic motion in the two-dimensional plane is important. Walk, drive, or bike with your child and discuss your speed (fast, slow, stopped); your heading (north, east, south, west); and your turns and turn angles (right turn, left turn, and the degree of turn).

See if you can issue a series of instructions to map out a square, such as "forward one block and turn right; do four times." Quantifying motion and direction leads to the ability to command the motion of objects when writing code. Repeated motions may appear as repeat or do loop code in programming.

03. Draw with an Etch-a-Sketch.

10 projects that will get kids excited about coding

As kids draw with an Etch-a-Sketch, they use controls to draw up-down and left-right, moving in similar fashion as in the neighborhood trek. But what's interesting about this activity is discovering what happens at the edge of the toy – the intersection of the red frame and the gray drawing area: the edge acts as a bumper, constraining the motion of the stylus.

Mathematically, the Etch-a-Sketch helps kids visualize boundary conditions, making real those inequality graphs you may recall from algebra. Move up past a certain positive y-coordinate and you hit the top edge; move down past a certain negative y-coordinate you hit the bottom edge (and similarly for motion left and right along the x-axis).

Simple drawing fun on the Etch-a-Sketch sets the stage for coding inequalities and boundary conditions in a program, for example, what happens when an object reaches a specific zone onscreen.

04. Watch the races on TV

10 projects that will get kids excited about coding

View a horse race and describe the action, start to finish. Chat with your kids to discuss how the race progresses. Notice that the horses all line up at the same starting point – the same x-coordinate. As they gallop down the track one horse pulls ahead for a bit, then drops back as another horse races ahead. The motion is not consistent – it appears as though the motion of the competitors is not constant, which creates excitement about who will win!

Coding non-constant motion can be accomplished by adding some randomness to the gallop speeds. (Randomness is important in games and simulations, whether you’re setting the speeds of cars driving the roadways, dispersing Sim shoppers in a mall, or determining whether a person catches a cold when sneezed on by an infectious individual.)

Finally, notice that winning a horse race means being the first horse to cross the finish line, a designated x-coordinate, different from that which designates the starting line.

05. Play a round of mini golf

10 projects that will get kids excited about coding

Ask your kids, "How do you aim the ball?" "What are the different intensities with which you hit the ball – drive, putt, tap?" "How does the ball bounce off obstacles – does it reflect at an angle?" "What indicates completion of a hole?"

Discussing as you play helps kids describe the physics of the game, and sets the stage for transferring that understanding to the virtual world of a video game where hit angle and intensity, object reflection, and color recognition (touching the black circle representing the hole) are coded.

06. Toss water balloons in the yard

10 projects that will get kids excited about coding

Throwing and catching water balloons helps kids think about vertical motion and targeting. Vertical motion is affected by gravity, so that objects speed up as they fall.

Kids have to take into account the distance to the target and compensate for the falling motion of the balloon when they aim – greater horizontal distances require aiming higher. (Some coding environments have built-in gravity simulation, while others don't.)

Kids also have to think about what it means to hit the target – a collision occurs when two objects share the same coordinates. The collision can occur when the balloon is caught by cupped hands, or splattered by the concrete sidewalk.

07. Cast votes on Britain's Got Talent

Voting requires use of counting variables to keep track of the number of votes accrued by each candidate. Working with a variable means knowing the starting value of the variable, then adding or subtracting a number of votes to obtain an updated value of the variable.

For each episode of Britain's Got Talent (or any other talent show), keep a running tally of household votes earned for each act, updating the totals each week. Translating this to the coding environment, if Susan Boyle is the variable, the code for adding a vote could look something like this:

setboyle boyle + 1

In plain English, this means "set the value of boyle to its previous value plus one." At the end of the season, the variable with the largest value indicates the winning act!

08. Play Rock, Paper, Scissors

Conditionals are if-then statements, and they are critical to coding. Here's an example of how you can introduce them in a game of Rock Paper Scissors. In the two-player game, each player uses his hands to represent one of the objects – rock, paper, or scissors.

If one player shows rock and the other player shows paper, then paper wins (paper covers rock). If paper and scissors are selected, then scissors win (scissors cut paper). Lastly, if rock and scissors are selected, then rock wins (rock smashes scissors). If the players show the same object, then the game is a tie. Note that all the rules of the game are if-then conditionals. Conditional statements allow the coding of different consequences depending on which conditions are met, thus exercising control over the outcome of events in the program.

09. Flip coins at the dinner table

10 projects that will get kids excited about coding

Flip a penny 100 times, tracking how many heads and how many tails result. Talk about the random nature of the outcome of each flip, and the probability of any one outcome (50-50). In a computer program, the results of a flip could be coded as follows:

if 0 = random 2 [setshape “heads] 
if 1 = random 2 [setshape “tails]

Discuss with your kids other random two-outcome scenarios: a new baby is either a boy or a girl; a radioactive atom has either decayed or not decayed; a light switch is either on or off; and your goldfish is either alive or dead.

Random-number generation is important when writing code, because it allows programmers to build in the same types of variations we observe in the real world (including those of the horse races described in #4).

10. Make a mad Lib

Text-handling may not be perceived as one of the sexier aspects of coding, but it's still extremely important. In fact, webpage layout relies greatly on formatting text in HTML to adjust fonts, colors, headings, and sizes.

Toying with text in word games helps kids think about how text is input, manipulated, and displayed in computer programs. One easy activity for kids is inviting them to create their own Mad Lib – a story with missing words that are filled in by another person.

The fun is that the "filler" knows nothing about the story, only to supply a noun, a verb, a celebrity name, a type of pasta, or other silly word type. By inserting the words into the blanks, a very silly story results – and the foundation is laid for coding text manipulation.

Words by: Camille McCue, PhD Author of Coding for Kids

For computer-based projects that transform these ten activities into kid-friendly coding lessons, check out Coding for Kids, available from Amazon UK and Amazon US.