Teach your kid to code in seven days with a Swift puzzle game!
The other day, my kid told his class: “When I grow up, I want to be a video game designer.” Not going to lie, my heart melted a little. But, that also raised a pretty big question: HOW? I’m not a coder. How am I supposed to provide that needed push to get him going in the right direction? That’s when I learned about Apple’s WWDC Swift Student Challenge (running through May 17). The challenge: Take seven days to create an interactive scene that can be experienced within 3 minutes.
While SuperParent has run stories talking about game coding for kids and coding camps in the past, it was high time to put our money where our collective mouths are; Time for us to roll up some sleeves and see if we…I mean, “HE,” can start coding in a couple of days.
All you need to join in on the Challenge: Download the Swift Playgrounds app for iPad or Mac. For the sake of this little experiment, we downloaded the “Lesson 1” installment and got to work.
A Game for 7 Year Olds
If my kid could make a game, what would it be? Without a pause, he blurts out, “Pirate Boxers! No, wait, Bad Guys Go Boom!” Honestly, I would buy either of those games based on the titles alone. Let’s see how this goes!
The Swift Playgrounds lessons are presented on a split screen. The right side looks like a conventional puzzle game. Byte, the cute bug-eyed critter needs your help getting steered around mazes, toggling switches, and collecting gems.
On the left, class is in session! Laid out is your challenge and the building block basics that help teach you how to code through trial and error. By putting the commands into the right order, you’re simultaneously fixing bugs and learning coding basics while playing a game.
My kid was a little frustrated at first, but when he realized that you’re not expected to get the right answer the first time, he started enjoying it a whole lot more. In fact, he told me that he was having a lot of fun.
We even goofed around, intentionally messing up at first to see what would happen. It’s all about experimentation, after all.
Bring on the next lesson!
The app does a great job of explaining the basics of grouping commands to create a function using the “how-you-tie-shoelaces” analogy. It’s a shortcut. A series of commands, stacked, that accomplish one function. So, of course, he wondered what would happen if you named that function, “velcro.”
We next moved onto creating our own macro functions…that he kept naming variants of “fart,” “poop,” and “butts.” Kinda hard to keep a straight face while line coding reads as…
Func butts () {
MoveForward ()
MoveForward ()
Fart ()
Poop ()
}
Still, he figured out the programming puzzles. Score one for potty humor!
What’s interesting to note is that the lessons stack nicely – what you wrap your head around in one chapter carries over to the next. Here, the landscape (and challenges you need to tackle) become a little trickier. In this section, you need to keep an eye out for repeating patterns and see how you can answer them with “For Loops.” As in, stack a series of commands (and functions) and have them repeat when it makes sense.
There was this wonderful moment of discovery when my kid would come upon the solution, work with me to enter lines, then run the code and see what happens.
I have fond memories of using “If / Then” statements and this brought it to light in a fun, easy-to-process way. For example, if Byte is underneath a gem, then he should grab it.
Throughout the ongoing trial-and-error process, my kid still had a good laugh when the code was wrong and Byte would mess up. This may (or may not) have inadvertently extended the lesson because he kept wanting to mess up.
While we couldn’t squeeze in the time for a proper 7-Day Challenge, Team Gladstone enjoyed what we’ve gone through together so far. The lessons scale nicely and logically — and before long, we were tackling some serious coding concepts.
One thing that kinda goes without saying, though: I could’ve picked an easier time to attempt all of this. I’m trying to balance school work, homework assignments, being a makeshift substitute teacher, and trying to actually get the day job done. I’m sure that one or two of you readers out there could relate.
So, I’ll just summarize quickly what’s next in our curriculum that we haven’t gotten to yet.
Logical Operators: Use true or false statements to perform tasks. One action if it’s “true,” another if it’s “false.” It’s basically letting the code make its own decisions if conditions are met.
While Loops: Like the above-mentioned “for loops,” this is a command that keeps repeating until a certain condition is met (a logical operator).
Algorithms: This final session in the “Challenge” wraps up all the lessons learned up to this point. After all, my kid and I had already been writing algorithms all along!
You’d think that some of this stuff would be tough for a young kid to absorb (especially now) and you’d be right…but he’s still having fun doing it. If you have a kid even remotely interested in games and you’ve got some time, I’d highly recommend this as a fun – and educational – break for you and your kid to bond over something that they could actually use in the future.
If you’re up for Apple’s (7-Day) Swift Student Challenge, you’ve got until May 17 to submit your entries. And if you’re interested in following updates on my kid’s new games, “Pirate Boxers” or “Bad Guys Go Boom,” we’ll keep you updated.