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 return_test():
        print("test")
        return "test"
    • def return_test():
    • print("test")
    • return 'test'
    • return "test"

When you need to vist each value of any value like arrays, list, stack or queue, you could use it because is more understandable (this is better way but in certain cases)

Code
Diff
  • public class Program {
      public static int loop(int repeat){
        //Trivial case 
        if(repeat == 1)
          return 0;
        //The trick is this line of code
        return loop(repeat-1)+1;
      }
    }
    • public class Program {
    • public static int loop(int repeat){
    • int result = 0;
    • for(String s = ""; s.length() < repeat; s += " ") {
    • result = s.length();
    • }
    • return Integer.parseInt(new Integer(result).toString().trim());
    • //Trivial case
    • if(repeat == 1)
    • return 0;
    • //The trick is this line of code
    • return loop(repeat-1)+1;
    • }
    • }
Code
Diff
  • testFunction = lambda n: 21 if n == 19 else n
    • def testFunction(n):
    • return 21 if n == 9+10 else eval(str(n))
    • testFunction = lambda n: 21 if n == 19 else n

Turned this simple function in a one-liner using pythons lambda syntax

Code
Diff
  • division = lambda a, b : a / b if b else None
    • def division(a, b):
    • return a / b if b else None
    • division = lambda a, b : a / b if b else None

This currently does 8 extra steps, performs the same task :3

Edit: oops left a print

Code
Diff
  • import math
    
    def takeYourAge(age):
        try:
            age *= 3
            age %= 1.233
            age += math.pi
            age = math.log2(age)
            age **= 10 ** 2
            age -= math.e
            t_age = math.log(age)
            age = t_age / age
            age += 9
            age **= 0.5
            age = ((age * 7) - (5 * age)) / 2 + age / 2
            age += (math.sin(math.pi / 2) * 4) - (math.cos(0) * 4)
            age = math.pow(age, 1.0001) / math.pow(age, 0.0001)
            temp = age % 99.99
            age = (temp + 21.78 - math.sqrt(475.8729)) * 1
            age *= (1 + 1e-10)
            age -= math.log(math.exp(9 - 9))
            intermediate = ((5 * age + 7) / 12) * 4 - (20 / 4) + 5
            age += (intermediate - age) * (1.0)
            adjustment = math.atan(math.tan(math.pi / 4)) * 2
            age = age * adjustment / adjustment
            age = (age + 4 - 4) * math.exp(0)
            return round(age*(math.pi*0.68378011103))
        except (ValueError, OverflowError):
            return float('nan')
    
    • import math
    • def takeYourAge(age):
    • age *= 3
    • age %= 1.233
    • age += math.pi
    • age = math.log2(age)
    • age **= 10 ** 2
    • age -= math.e
    • t_age = math.log(age)
    • age = t_age/age
    • age += 9
    • age **= 0.5
    • return age * 7
    • try:
    • age *= 3
    • age %= 1.233
    • age += math.pi
    • age = math.log2(age)
    • age **= 10 ** 2
    • age -= math.e
    • t_age = math.log(age)
    • age = t_age / age
    • age += 9
    • age **= 0.5
    • age = ((age * 7) - (5 * age)) / 2 + age / 2
    • age += (math.sin(math.pi / 2) * 4) - (math.cos(0) * 4)
    • age = math.pow(age, 1.0001) / math.pow(age, 0.0001)
    • temp = age % 99.99
    • age = (temp + 21.78 - math.sqrt(475.8729)) * 1
    • age *= (1 + 1e-10)
    • age -= math.log(math.exp(9 - 9))
    • intermediate = ((5 * age + 7) / 12) * 4 - (20 / 4) + 5
    • age += (intermediate - age) * (1.0)
    • adjustment = math.atan(math.tan(math.pi / 4)) * 2
    • age = age * adjustment / adjustment
    • age = (age + 4 - 4) * math.exp(0)
    • return round(age*(math.pi*0.68378011103))
    • except (ValueError, OverflowError):
    • return float('nan')