Step two squares forward, stop, turn right. If the sheep is woolly, shear it.
Those are the kind of commands students at Duke of Connaught Public School coded on Dec. 7 for the Hour of Code.
If they got it right, a blocky Minecraft character jumped for joy on their phone or laptop screen, thrilled by a bob of virtual wool.
Started three years ago by the non-profit Code.org, the Hour of Code is just what it sounds like – a one-hour intro to basic computer programming.
“It’s powerful stuff,” says Stephen Gilbert, who teaches science, media and technology at Duke. “They’ve really thought about all the obstacles to getting kids thinking in programmatic way.”
Many students start by writing basic commands into hit games like Minecraft or Angry Birds – a fun first glimpse into how a program runs.
But beginners don’t even need a computer to get going. Last year, Gilbert had students in Grades 1 to 3 imagine the tiles on their classroom floor as pixels on a screen.
On paper, they then drew long strings of arrows and stop signs – code they ran by having a student walk tile-to-tile like a video game character, hopefully dodging obstacles on the way.
Later, they tried it again without tile guides, meaning the code had to be written for students with different strides.
“It was a lot of fun because it made it physically real,” said Gilbert.
Besides the annual Hour of Code, which ran at three difficulty levels open to students from Grades 1 to 8, Gilbert also organizes a Gamers Club at Duke.
Jaiden Fairclough is one of the Grade 8 members, and earlier this year he won a raffle to be one of the club’s three student mentors.
“It’s the first time I’ve won something in my life,” said Fairclough, speaking between coding his own combat game at eating lunch in the school’s “maker space” – a class with laptops, woodworking tools, even a 3D printer that was churning out a mini Toronto City Hall in blue plastic.
Typing next to Fairclough, fellow Gamers Club senior William Chan was coding a dungeon-crawler game in Java, a full-strength programming language.
At 12, Chan already has five years of coding know-how, enough to ask his teacher questions he can’t answer.
“Playing games was fun, and I wanted to design my own,” Chan said.
“All you need is to understand logic, and then learn the syntax, which isn’t too hard. You need to know a lot of math if you’re doing game development.”
Erin Coughlan, a Grade 7 student, agreed with Chan that debugging is coding’s biggest challenge.
“It’s a whole new language,” she said.
Besides learning to make their own games or phone apps, Gilbert said coding is a fun, creative pursuit that helps kids understand some key principles that underlie all science, such as what a variable is, or how to create a fair test.
Ernest Yap, a geospatial engineer who dropped by the Hour of Code on his first day of being Duke’s engineer-in-residence, was impressed to see the tables full of coding kids.
“I only started learning code in university,” said Yap. “This is great.”