Begin a new Kumite
  • Filter by Language:
  • Kumite (ko͞omiˌtā) is the practice of taking techniques learned from Kata and applying them through the act of freestyle sparring.

    You can create a new kumite by providing some initial code and optionally some test cases. From there other warriors can spar with you, by enhancing, refactoring and translating your code. There is no limit to how many warriors you can spar with.

    A great use for kumite is to begin an idea for a kata as one. You can collaborate with other code warriors until you have it right, then you can convert it to a kata.

This works now...

The JVM runner doesn't use javac to compile; the runner uses the JVM's builtin compiler that it gets from, and loads the result into a thread.

If there's no fixture, it infers the class from the code and runs <Class>.main() (all of this is done in clojure, which is what I wrote the JVM runner in).

I didn't originally give it arguments because there's nothing sensible to set them to. After some thought, maybe the right thing to set them to is an array containing "Arguments Disabeled".

Also, clojure really wants the class you export from your solution code to be public ; I think there's a way around this but it'll require some research.

We're also clearly swallowing error messages from exceptions, which is bad.

  • public class JavaJava {
        public static void main() {
            System.out.println("Hello Java");
  • 1
    class Solution {
        public static void main(String[] args) {
            System.out.println("Hello World :D");
    public class JavaJava {
        public static void main() {
            System.out.println("Hello Java");

Recent Moves:

Best Practices

This is an example from the Style Guide for Python Code, accompanied by the statement "Make sure to indent the continued line appropriately. The preferred place to break around a binary operator is after the operator, not before it."

class Rectangle(Blob):

    def __init__(self, width, height,
                 color='black', emphasis=None, highlight=0):
        if (width == 0 and height == 0 and
                color == 'red' and emphasis == 'strong' or
                highlight > 100):
            raise ValueError("sorry, you lose")
        if width == 0 and height == 0 and (color == 'red' or
                                           emphasis is None):
            raise ValueError("I don't think so -- values are %s, %s" %
                             (width, height))
        Blob.__init__(self, width, height,
                      color, emphasis, highlight)

Showcase your personal style for a purpose of your choosing! How would you write this for a Best Practices kata solution? A Clever kata solution? Something else?

I've reformatted it in my personal style for open-source code.

class Rectangle(Blob):
    def __init__(self,
        if (width, height) == (0, 0):
            if color == 'red' and emphasis == 'strong' or highlight > 100:
                raise ValueError('sorry, you lose')
            elif color == 'red' or emphasis is None:
                raise ValueError("I don't think so -- values are %s, %s" % (width, height))

Okay, this works for me right now...

  • public class Java {
      public static int multiply(int x, int y) {
        return y * x;
  • 11
    public class Java {
      public static int multiply(int x, int y) {
        return x * y;
        return y * x;

Recent Moves:

Checking to see if the clojure runner has the same problems as the Java runner. Apparently not...

(ns codewars.sanity.check)

(defn multiply [ & args ] (apply * args))

int main() {
  printf("Hello, C!\n");
Control Flow
Basic Language Features
Language Syntax
Declarative Programming
Functional Programming
Higher-order Functions

Javascript function-based Array 'syntax':

 This is an interesting kata that I came across today*, in which a function was called in this kind of fashion, previously unseen by me:

someFunction(6)()()(2)()()(1).end();  // Wierd, right?

 To an experienced JavaScripter, this will immediately seem clear: The function is returning another function, that returns itself, and has a method end() to 'terminate' the chain.

Interested by this, I made this kumite describing a similar function that would create an Array. I also changed end to a variable rather than a function, because one, I'm addicted to ruby** syntax, and two, it's generally easier on the fingers!

// 'chain(arg)...(arg).end;' is equivalent to '[arg...arg];'

chain().end;               // [null]
chain(1)(2)(3).end         // [1, 2, 3]
chain('hey')()(true).end   // ['hey', null ,true]

Suggestions for future forks:

  • Improve the syntax further: Add a bit of syntax to describe repetition of an element, maybe chain(6)(3,2)(6) => [6,3,3,6]?
  • Make this in other languages: Is it possible? How, or why not?
  • Refactor this code: I'm pretty sure I've got this nailed, but I'd still like to see how other people do it!

* This kumite was inspired by this kata, which I really reccomend having a shot at.

** I can't seem to create a Ruby equivalent, If you work out how, please make a fork!

// This is just an interesting alternative way to build an array,
// almost like a declarative literal - Very cool stuff!

// See test cases for syntax.

function chain(element) {
  var array = [element];
  var sectionBuilder = function(elem) {
    sectionBuilder.end = array;
    return sectionBuilder;
  sectionBuilder.end = array;
  return sectionBuilder;