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
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.
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 ofmoveDown()
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.
- 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
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.
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.
4 Comments