Teach coding with games: a review of Codewars and CodeCombat

No readers like this yet.
Leveraging 21st-century education with open source

Opensource.com

I recently stumbled upon two websites for learning coding and programming skills: CodeCombat and Codewars. Both use a free software philosophy (all code examples are open source licensed and/or available GitHub) and help teach different computer programming languages. I tested CodeCombat and Codewars out when some of my students were seeking to learn the Python programming language.

CodeCombat

CodeCombat screenshot

Screenshot provided by Horst Jens. CC BY-SA 4.0.

CodeCombat has a focus on gamification that makes it suitable for a younger audience. If you like RPG games with cartoon fantasy graphics, you'll enjoy it too. The game builds on older learn-to-code systems such as Rurple and Karel. The screen is split between a code editor on the right and a labyrinth on the left half. Inside the labyrinth is an avatar the player can control using a restricted set of commands (e.g. self.moveDown(), self.moveRight(), self.attack(self.findNearestEnemy()), etc.). Commands have to be typed correctly to control the avatar, and incorrect programs with logical faults (like commanding the avatar to run against a wall) will cause it to lose hit points and eventually die.

In each level, the player is assigned a set of tasks—usually to collect gems, defeat monsters, and move to the exit of a level. The player is gradually introduced to new commands like loops, conditionals, and variables. Diamonds collected in a level can be invested between levels for better armor, weapons, and programming commands (cleverly symbolized as spellbooks and magic devices) to master the increasingly tricky tasks in the higher levels.

CodeCombat begins with a smooth learning curve well suited to players with no coding experience. As the player progresses, the tasks involve more complex programming concepts. Most importantly, the levels themselves become more complex due to more possible interaction with the objects in the game world: fences can be built, fire traps can be set, enemies can be lured into minefields, special weapons allow special attacks with a cooldown timer, etc.

In addition to beautifully designed levels, the game's later stages also boast riddles that are complex enough to fascinate gamers and coders alike.

License

CodeCombat itself can be found on GitHub under the free MIT license. All the art assets (sprites, backgrounds, sound effects, etc.) can also be found on GitHub and are published under a Creative Commons CC BY 4.0 license. This allows easy use of the game artwork for projects of students.

Business model

The licenses and attributions are explained in more detail on the CodeCombat legal page. CodeCombat reserves the right to publish levels for CodeCombat created and uploaded with the CodeCombat level editor under a non-free license.

The current business model relies on "nudging" parents and teachers into a US$9.99/month subscription to gain access to video tutorials, more levels, and more (virtual) diamonds. While the built-in advertising and nudging to subscribe may be slightly irritating for some players, it's a legal way to build a business ecosystem around a free/libre/open source core.

Because the complete CodeCombat source code is on GitHub, forkers can create their own code combat system with a different business model (or no business model at all) attached to it.

User participation

CodeCombat seeks user contributions for level-design, coding, translation, and other tasks. I especially look forward to community-created content from teachers and educators, like lesson plans or best-practice guidebooks for integrating CodeCombat sessions into computer science courses.

CodeCombat ways to contribute

Screenshot provided by Horst Jens. CC BY-SA 4.0.

Teaching experience

My own experience with using CodeCombat in my programming courses was pleasant. CodeCombat was a hit with my 11-year-old students and often attracted older students willing to "help." Students were able to figure out most of the tasks for themselves with little to no assistance from a teacher. For some levels, the task description is hidden in the code comments. On higher levels, my German-speaking students' limited English skills were a problem.

The gamification worked very well, especially among younger students. They loved spending time pondering how best to invest their hard-earned virtual diamonds and were very pleased when they earned superior virtual armor and weapons.

Critique

I don't have much to criticize, but there were a few things:

    • Pythonic non-python: CodeCombat students learn a lot of commands that only exist in the game world. While this is fine in the game, some "structural" commands like loop: could have easily been replaced by the correct Python command (while True:).
    • Forced Object orientation: CodeCombat introduces commands like self.moveDown() instead of moveDown() at the beginning, indicating that the avatar is an instance of an avatar class. While I like the concept of doing it right from the start and explaining later, I wonder if it's really necessary to force object-oriented concepts onto students right away when the necessary teaching (loops, conditionals, variables) could be as well taught without object-orientation paradigm. I guess it's to enable CodeCombat to use other programing languages like Java.

 

Codewars

Codewars is a more mature version of CodeCombat. Students aren't guided through lessons, but instead confronted with programming tasks—not unlike the homework assignments of a typical computer science class.

Kata

Each programming task is in reference to a Japanese martial art called Kata. They include a short task description, a set of input data, and the desired output data. The student is tasked with writing a function in his preferred programming language to transform the given input into the desired output. This is all done with the online, built-in programming editor.

The student is also tasked with writing his own tests, and the outcome of the tests (pass or fail) give clues as to whether the code is ready to submit to the public. To make the Katas more difficult, the given set of input-output data in the task description is only a subset of the data used to test a Kata before submitting it to the public. The user can run his function against his own test with a button or can press "submit" to test it against the bigger, hidden dataset. Only once all tests are passed can the function be uploaded to and inspected by the public.

This is a very revealing moment: even for a seemingly simple and straightforward problem there exist countless different solutions. Solutions can be upvoted as "best practice" so that the swarm intelligence of all coders sort the most acceptable solution to the top. It is also possible to vote a solution as "clever."

There's also a built-in web forum where Kata solutions can be discussed.

There's not much gamification in Codewars, but solving Katas—along with a few other activities—will slowly raise a student's rank.

Codewars screenshot

Screenshot provided by Horst Jens. CC BY-SA 4.0.

Kumite

A step up from Katas are Kumites, more complex coding problems where other coders are invited to refactor code and provide solutions.

Teaching experience and critique

While I personally like Codewars, I found it less than ideal for teaching Python (I tested it on with 14-year old, German-speaking students with some Python knowledge and basic knowledge of English). In contrast to CodeCombat, the teaching must happen before Codewars is used, or a student must have the skill and self-discipline to learn necessary coding skills other ways.

The biggest problems were understanding the task description and understanding how to use write tests. Simply put, most tests use the assert.equal statement:

Test.assert_equals(function_name('input data'),'desired output data')

Unfortunately, this line was not present in the test area in all Katas, further confusing students.

However, Codewars offers huge learning opportunities by looking at (and discussing) the solutions of others. It is also a good tool for tackling Katas already solved in a preferred programming language with a different, new programming language.

Lastly, Codewars is well suited for introducing the concept of pair programming via coding dojos: two students have to solve a Kata together with one doing the thinking (navigator) while the other does the typing (driver). After a given time interval or after at least one test is passed, a new student becomes driver and the driver becomes navigator.

Participation and license

Codewars users are encouraged to participate. The ability to discuss, share, and fork Katas and Kumites is built-in. As stated in the Codewars terms page, all uploaded code is licensed under the FreeBSD 2-Clause license.

Business model

It's not obvious what the business model is for Codewars. I think the site could become useful as a recruiting tool for IT jobs, but I hope the site will attract enough donations from thankful computer science teachers, like me, who finally have been able to rid themselves of the need to create and score homework.

Originally posted at spielend-programmieren.at. Republished with permission under Creative Commons.

Avatar
teaching open source game programming courses to children in my company in Vienna, Austria

4 Comments

Hi Mr. Jens,
Thank you for your review on Code Combat. I just found out this game and want to know more of it, and your review of the game as a teacher is a good help for me. I have a few questions about learning coding through code combat, and hope you can help.

I am a adult learner and already tried to learn all the basic syntax of python, java and swift. however, I found it very difficult to go deeper in learning the languages and make use of it. I tried to read through apple's swift documentation and the basics are fine, but the in-depth uses of protocols, extension, generics, advanced operators etc are tortuously difficult to grasp. I think the problem is that the examples provided are too few and not engaging. I set my hope high on Code Combat to help me become a good programmer, my worry is code combat only deal with basic syntax and provide no guides on anything deeper.

I like the idea of learning programming through gaming, as it engages me with specific tasks and requirements. however, my worry is that the game levels are too simple and won't go deep enough to help me become intermedium or advanced level programmer.

On the other hand, I don't want to give up the hope. I feel my worry may be unnecessary due to the Open Source nature of Code combat. I assume that being able to fully engaged with playing the game and reading the source code, I should be able to climb up to intermediate programmer. Is this plausible? then the question is will the source code be too deep to comprehend for people who just get the basic syntax?

looking forward to hearing from you
Best,

hubert

Hi Hubert,
glad to hear you liked the article, and congratulation for being an adult learner!
The way from understanding basic syntax to coding meaningful, complex programs is a long one, independent of programming language and learning ideology. For my own (young) students, i use Python and easygui, others have success with diving into html, css and javascript. It depends on what topic fascinates you. What no programming book, game or video can give you is experience; it comes with time, it needs passion.

I reccomend heading to reddit/r/learntocode to discuss learning strategies with others. I also suggest finding a nice, little(?) open-source project at github, something that really fascinate you. Start humble by asking the project admins how you can help out, not necessary with coding: testing, writing documentation, helping to sort issues and answer in the forums, reviewing and commenting code etc. I personally find it very rewarding to go to programmers conferences or user groups meetings. As you get more involved with your pet project and it's people you will learn a lot, mostly by and from others. Focus on your passion!

In reply to by hubert

Hi Mr. Jens,
Thank you so much for your advices. They are very insightful. I will try to apply these advices into Code Combat.

I wish codewars could improve their ranking process by making it specific per language and not overall.They can rank by country and allow recruiters to search for people in different parts of the world.Another problem in codewars is that it is near to impossible to search for clans to join,also kata ratings is becoming flawed since most of the people ranking are the top 10% who might see a 6kyu kata so trivial and rate it as 8kyu making beginners confused.There also is need to improve tagging katas before it is approved,a kata might contain only a fundamental tag but in reality it needs so many others such as algoriths,regex,mathematics,optimization etc.One thing i have also noticed is too many mathematical or physics katas coming up such as those in project euler,this is not a bad thing but i hope to see more real world katas without mathetical theorems being a prerequisite.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.