Microsoft Research Launches Browsing Puzzle Game Learning Programming



    Microsoft Research on its blog announced the launch of the Code Hunt browser-based puzzle game to teach programming in C # and Java.
    The player is given code fragments with previously unknown functionality. The goal of the game is to, based on the input and the expected result, change the code of the method or function so that the output matches this expected result.



    At the beginning of the game, the player chooses in which language (Java or C #) code fragments will be presented. In the future, during the game at any time you can switch from one language to another. The game is divided into sectors corresponding to different programming topics (loops, arrays, working with strings, etc.). Each sector, in turn, consists of several levels, arranged in increasing order of complexity. Passing the level is estimated by one, two or three "bricks" depending on the "elegance" of the written code. The shorter the code, the more elegant it is considered. For example, in the task of counting the number of characters 'a' in a string, the code
    publicclassProgram{
    	publicstaticintPuzzle(String s){
    		int result = 0;
    		for (char c : s) {
    			if (c == 'a') 
    				++result;
    		}
    		return result;
        }
    }

    It is evaluated in one brick on the elegance scale, but the code that has the same functionality, but written using regular expressions is already three bricks:
    publicclassProgram{
        publicstaticintPuzzle(String s){        		
    		return s.replaceAll("[^a]", "").length();
        }
    }

    Of course, this game is more suitable for the category of puzzles or puzzles than programming instructors, but as a workout for the brain is very addictive.

    Also popular now: