Start a new Kumite
AllAgda (Beta)BF (Beta)CCFML (Beta)ClojureCOBOL (Beta)CoffeeScriptCommonLisp (Beta)CoqC++CrystalC#D (Beta)DartElixirElm (Beta)Erlang (Beta)Factor (Beta)Forth (Beta)Fortran (Beta)F#GoGroovyHaskellHaxe (Beta)Idris (Beta)JavaJavaScriptJulia (Beta)Kotlinλ Calculus (Beta)LeanLuaNASMNim (Beta)Objective-C (Beta)OCaml (Beta)Pascal (Beta)Perl (Beta)PHPPowerShell (Beta)Prolog (Beta)PureScript (Beta)PythonR (Beta)RacketRaku (Beta)Reason (Beta)RISC-V (Beta)RubyRustScalaShellSolidity (Beta)SQLSwiftTypeScriptVB (Beta)
Show only mine

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.

Ad
Ad
Code
Diff
  • def pyramid_of_x(n):
        if n < 2:
            return 'Not enough building blocks!'
        
        rows = []
        for row in range(n):
            rows.append('*' * (row + 1))
        
        return '\n'.join(rows)
    
    • def pyramid_of_x(n):
    • if n < 2:
    • return 'Not enough building blocks!'
    • return '\n'.join('*' * i for i in range(1, n + 1))
    • rows = []
    • for row in range(n):
    • rows.append('*' * (row + 1))
    • return '\n'.join(rows)

changed to f-string

Code
Diff
  • def where_were_you_when_codewars_died(activity='codewarz', location='127.0.0.1', food_source='coffee'):
        db = Connection()
        record = f"I was at {location} consuming {food_source} when {activity} died."
        return db.add_record(record)
        
    
    • def where_were_you_when_codewars_died(activity='codewarz', location='127.0.0.1', food_source='coffee'):
    • db = Connection()
    • record = "I was at {0} consuming {1} when {2} died.".format(location, food_source, activity)
    • record = f"I was at {location} consuming {food_source} when {activity} died."
    • return db.add_record(record)

A long time ago in a Kumite far, far away.

Code
Diff
  • def codewarz():
        """Dialgue from Codewarz episode 3, Revenege of the Algorithms."""
        sith = DarthSidious('Palpatine')
        jedi = Seraph('Seraph')
        # sith dialogue/actions:
        s1 = sith.speak()[0]
        s2 = sith.speak()[1]
        s3 = sith.use_the_force()
        # jedi dialgue/actions:
        j1 = jedi.speak()
        j2 = jedi.draw_light_saber()
        j3 = jedi.use_the_force()    
        return {'s1':s1, 's2':s2, 's3': s3, 'j1': j1, 'j2':j2, 'j3':j3}  
        
    • def l():
    • return "Did you ever hear the tragedy of Darth Plagueis The Wise? I thought not. It’s not a story the Jedi would tell you. It’s a Sith legend. Darth Plagueis was a Dark Lord of the Sith, so powerful and so wise he could use the Force to influence the midichlorians to create life… He had such a knowledge of the dark side that he could even keep the ones he cared about from dying. The dark side of the Force is a pathway to many abilities some consider to be unnatural. He became so powerful… the only thing he was afraid of was losing his power, which eventually, of course, he did. Unfortunately, he taught his apprentice everything he knew, then his apprentice killed him in his sleep. Ironic. He could save others from death, but not himself."
    • def codewarz():
    • """Dialgue from Codewarz episode 3, Revenege of the Algorithms."""
    • sith = DarthSidious('Palpatine')
    • jedi = Seraph('Seraph')
    • # sith dialogue/actions:
    • s1 = sith.speak()[0]
    • s2 = sith.speak()[1]
    • s3 = sith.use_the_force()
    • # jedi dialgue/actions:
    • j1 = jedi.speak()
    • j2 = jedi.draw_light_saber()
    • j3 = jedi.use_the_force()
    • return {'s1':s1, 's2':s2, 's3': s3, 'j1': j1, 'j2':j2, 'j3':j3}
Code
Diff
  • using System.Linq;
    
    public class Kata
    {
      public static bool ContainsCommonItem(char[]a, char[]b) => a?.Any(x => b?.Contains(x) ?? false) ?? false;
    }
    • //Given 2 Arrays, Return True if arrays contain common item, else false.
    • //e.g a= ['a','b','g','c'] and b =['z','e','c'] returns true
    • //input : 2 arrays
    • //output: bool
    • using System.Linq;
    • using System.Linq;public class Kata{public static bool ContainsCommonItem(char[]a,char[]b)=>a!=null&&b!=null&&a.Intersect(b).Any();}
    • public class Kata
    • {
    • public static bool ContainsCommonItem(char[]a, char[]b) => a?.Any(x => b?.Contains(x) ?? false) ?? false;
    • }