Gamification and coding

One of the big trends this decade has been gamification. By turning everyday tasks into games, the theory goes, a person’s natural competitive streak will be triggered, causing that person to put more effort into accomplishing the task, and accomplishing it well. Companies do it with their employees, web forums have begun to implement it for their users and moderators, and so on.

It was only a matter of time before someone brought it to programming. Actually, that happened years ago. Coding competitions have been around a long time, but I saw a link to CodinGame the other day, and that got me thinking.

Games people play

The idea behind gamification isn’t hard to understand. Humans are competitive by nature. We like to win, to be better than the rest. And we really like it when there’s an objective measure of just how much better we are. The Olympics weren’t that long ago, and how many of you remember watching in anticipation, staring at the world records in the corner of the screen? How often were you on the edge of your seat, waiting for the judges’ scores to pop up?

It’s not just sports, though. Most games have some element of scoring, some record of accomplishment. In Monopoly, for example, you’ve got an obvious one: the amount of money in front of you. (Unless you’re playing one of those newer versions with the credit cards, in which case, why?) In video games, tables of high scores have existed for decades, especially in arcade games. And we wanted to set those high scores so bad, because that brought a small measure of fame. Everyone could see that MHP (or whatever) was the best at that game, at least until somebody posted a better score.

Today, when we play over the Internet instead of in public, we have online leaderboards instead, but the principle is the same. It drives us to improve, to reach for that top spot. (Story time: While my brother was working at Amazon a few years ago, I spent about three hours on his XBox, playing Forza 4 and trying to set a record in one of its weekly challenges, a quarter-mile drag race. It was some of the most fun and satisfying gameplay I’ve ever had, even though I never got higher than about 26th.)

Achievements are another popular aspect of modern games, and they work the same way. As Pokemon taught us: you gotta catch ’em all! And that’s how it is with achievements. We see that list, those empty spots, and we have goals. We have something to strive for.

That’s what gamification is. It’s the transfer of that competitive urge, that desire to complete a set or simply win, to mundane work. By adding points and trophies and collectibles, we transform drudgery into entertainment. Whether at school, on the job, or in a social setting, these artificial goals effectively make us believe we’re playing a game. Games are fun, right? So if we make the boring stuff into a game, then it magically becomes fun! Well, maybe. It doesn’t always work, and it’s not for everybody.

Games without frontiers

In theory, almost anything can be gamified, but we’re talking about programming here, so let’s stick to that. How can we make writing computer programs into a game? There are a few obvious answers. One is to make a game about coding, as with else heart.break() or TIS-100. That works, but it’s very much a niche. Another option is adding subtle programming abilities into an otherwise unrelated game. Minecraft has redstone, for example, which allows you to build logic gates, the building blocks of computing, while Final Fantasy XII gave players a bit of power to program their AI-controlled party members. In those cases, however, the programming part is not the focus. It’s an aside, sometimes an unwelcome one.

True gamification of coding, as CodinGame does, is different. It’s more of a series of programming challenges, each with objective measures of success and prowess. Code has to be correct, first and foremost. It has to do what it was designed to do. It’s also good if it’s fast; given two identically correct programs, the faster one is usually considered better. Space is another factor—smaller is generally better—and you can come up with other metrics. (“Lines of code”, by the way, is not a very good one.)

Once you have a way of measuring the “score”, you’re halfway to making a game of it. Post the scores publicly, and watch as coders eagerly train at their craft for no other reason than to move up a spot or two. It’s almost like magic!

Can it work, though? I don’t know. It works for a lot of people, but not everyone. We’re not all the same. Some of us don’t have that competitive streak, or we don’t act on it. For them, gamification is a waste of time. But for the rest of the populace, it can create a reason to learn, a reason to want to learn. That’s something the world could use a lot more of, so I say it’s worth a shot.

Leave a Reply

Your email address will not be published. Required fields are marked *