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 replicate(times, num):
        if times<=0:
            return []
        else:
            return [num]+replicate(times-1,num)
    print(replicate(8,5))
    • def replicate(times, num):
    • return [] if times <= 0 else [num] + replicate(times-1, num)
    • replicate(8,5)
    • if times<=0:
    • return []
    • else:
    • return [num]+replicate(times-1,num)
    • print(replicate(8,5))
Code
Diff
  • extension String {
      func insert(_ value: String, n: Int) -> String {
        guard n > 0 else { return self }
        
        var result: String = ""
        
        stride(from: 0, to: self.count, by: n).forEach { i in
          let startIndex = self.index(self.startIndex, offsetBy: i)
          let endIndex = self.index(startIndex, offsetBy: n, limitedBy: self.endIndex) ?? self.endIndex
          result += (result.isEmpty ? "" : value) + self[startIndex..<endIndex]
        }
        
        return result
      }
    }
    
    • extension String {
    • func insert(_ value: String, n: Int) -> String {
    • guard n > 0 else {
    • return self
    • }
    • var ndx = 0
    • return self.reduce("") { (string, c) in
    • guard ndx < n else {
    • ndx = 1
    • return "\(string)\(value)\(c)"
    • }
    • ndx += 1
    • return "\(string)\(c)"
    • guard n > 0 else { return self }
    • var result: String = ""
    • stride(from: 0, to: self.count, by: n).forEach { i in
    • let startIndex = self.index(self.startIndex, offsetBy: i)
    • let endIndex = self.index(startIndex, offsetBy: n, limitedBy: self.endIndex) ?? self.endIndex
    • result += (result.isEmpty ? "" : value) + self[startIndex..<endIndex]
    • }
    • return result
    • }
    • }
Code
Diff
  • mmr=lambda p,w:(-1)**(not w)*(30-10*p)
    
    • def mmr(party: bool, win: bool) -> int:
    • if party:
    • if win:
    • return 20
    • return -20
    • if win:
    • return 30
    • return -30
    • mmr=lambda p,w:(-1)**(not w)*(30-10*p)
Code
Diff
  • find_first_sub_string=lambda text,sub:[None, index:=text.find(sub)][index>-1]
    print(find_first_sub_string)
    
    • find_first_sub_string=lambda text,sub:[None, index:=text.find(sub)][index>-1]
    • find_first_sub_string=lambda text,sub:[None, index:=text.find(sub)][index>-1]
    • print(find_first_sub_string)
Code
Diff
  • def power(num, p):
        return num ** p
    • def power(num, p):
    • return num **p
    • return num ** p