What if coding were a game?
Well, now it is. Today, we are pleased to announce the launch of Code Hunt, a browser-based game for anyone who is interested in coding. We built Code Hunt to take advantage of the fact that any task can be more effective and sustainable when it’s fun. And Code Hunt is fun! It uses puzzles, which players explore by means of clues presented as test cases. Players iteratively modify their code to match the functional behavior of secret solutions. Once their code matches, lights flash and sounds play, letting players know that they have “captured” the code. Players then get a score, which depends on how elegant their solution is, and are encouraged to move on to the next puzzle or level.
When we demoed Code Hunt a few months ago, we were amazed at the interest it elicited across groups at Microsoft, from those involved with K-12 education to those focused on college recruiting. However, today we want to talk about how Microsoft Research Asia used Code Hunt during their annual Beauty of Programming (BOP) event, a competition that attracts thousands of students in the Greater China Region (GCR).
In the past, the BOP competition gave students specifications for problems and then checked their solutions automatically using a test suite. This is the traditional approach: students pit their wits against each other—and against the clock—to create a solution to a defined problem. While this kind of coding is similar to what they will encounter in courses or later in their careers, it isn’t necessarily fun.
Code Hunt is different. Instead of giving students a problem and comparing their solutions to a set of fixed test cases, Code Hunt does the opposite: it presents an empty slate to the user and a set of constantly changing test cases. It thus teaches coding as a by-product of solving a problem that is presented as pattern matching inputs and outputs. The fun is in finding the pattern. Fun is seen as a vital ingredient in accelerating learning and retaining interest during what might be a long and sometimes boring journey towards obtaining a necessary skill—or in this case, winning a competition. The GCR team recognized that Code Hunt would not only make the BOP competition more fun, but it would also enable them to check the solutions more quickly and accurately.
With considerable optimism, we opened Code Hunt to BOP competitors in April. In three rounds, 2,353 students scored in the game, and the contestants solved an average of 55.7% of the puzzles. Since Code Hunt runs on Microsoft Azure, we have all the statistics. We could see that, on average, it took players 41 tries to capture the code for puzzles. However, we were really interested in the 350 top students who solved all of the puzzles—even the most difficult ones. These students needed only 7.6 tries on average to solve a puzzle, showing that Code Hunt can reliably surface the better coders. From these students, 13 were selected to proceed to the finals, and we wish them luck.
Code Hunt was developed by a team in Microsoft Research led by Principal Development Lead Nikolai Tillmann and Principal Research Software Engineer Peli de Halleux. It is based on Pex, Microsoft Research’s state-of-the-art implementation of dynamic symbolic execution (analyzing a program to determine what inputs cause each part of a program to execute), which is available as a Power Tool in Microsoft Visual Studio.
We look forward to Code Hunt’s further application and would be happy to receive inquiries regarding competitions or courses. But remember, anyone can play Code Hunt—for fun or to hone their coding skills. Just go to www.codehunt.com and start coding!