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
Code
Diff
  • const greet = () => 'Hello World!';
     
    
    • function Greet(){return "Hello World!"}
    • const greet = () => 'Hello World!';
Code
Diff
  • const removeEveryThird = str => str[0]+[...str].filter((a,i)=> i%3!==0).join('')
    • function removeEveryThird(str) {
    • return (str[0] || '') + str
    • .slice(1)
    • .replace(/(..)./g, '$1')
    • }
    • const removeEveryThird = str => str[0]+[...str].filter((a,i)=> i%3!==0).join('')
Code
Diff
  • def hello():
        return "Hello word" #p fix the test code 
    • print("Hello", "word") #p fix the cde dumbfuck
    • def hello():
    • return "Hello word" #p fix the test code
Code
Diff
  • public class Kumite {
      public static bool IsThree(int x) => x.ToString().Contains('3');
    }
    • public class Kumite {
    • public static bool IsThree(int x) =>
    • x.ToString().Contains('3');
    • public static bool IsThree(int x) => x.ToString().Contains('3');
    • }

One line reduction method

Code
Diff
  • import java.util.*;
    
    public class Kata {
        public static int findMax(int[] my_array) {return Arrays.stream(my_array).reduce(my_array[0], (x, y) -> x > y ? x : y);}
    }
    • import java.util.*;
    • public class Kata {
    • public static int findMax(int[] my_array) {
    • // Write a method that returns the largest integer in the list.
    • // You can assume that the list has at least one element.
    • Arrays.sort(my_array);
    • return (my_array[my_array.length-1]);
    • }
    • public static int findMax(int[] my_array) {return Arrays.stream(my_array).reduce(my_array[0], (x, y) -> x > y ? x : y);}
    • }

Dictionary :)

Code
Diff
  • def converter(number):
        dictionary = {
            0: "zero",
            1: "one",
            2: "two",
            3: "three",
            4: "four",
            5: "five",
            6: "six",
            7: "seven",
            8: "eight",
            9: "nine",
            10: 10
        }
        return dictionary[number] 
    
    • def converter(number):
    • match number:
    • case 0:
    • return 'zero'
    • case 1:
    • return 'one'
    • case 2:
    • return 'two'
    • case 3:
    • return 'three'
    • case 4:
    • return 'four'
    • case 5:
    • return 'five'
    • case 6:
    • return 'six'
    • case 7:
    • return 'seven'
    • case 8:
    • return 'eight'
    • case 9:
    • return 'nine'
    • case _:
    • return number
    • dictionary = {
    • 0: "zero",
    • 1: "one",
    • 2: "two",
    • 3: "three",
    • 4: "four",
    • 5: "five",
    • 6: "six",
    • 7: "seven",
    • 8: "eight",
    • 9: "nine",
    • 10: 10
    • }
    • return dictionary[number]
Code
Diff
  • def meaning_of_life_is():
        return ord('*')
    
    • def meaning_of_life_is():
    • return """
    • go crazy with your imagination and return anything you like.
    • strings, numbers, ... just don't return None.
    • may the most creative answer win
    • """
    • def meaning_of_life_is():
    • return ord('*')
Fundamentals
Code
Diff
  • def numberprint(x):
        f = ''
        for i in range(x):
            f += str(i)
        for i in range(x,0,-1):
            f += str(i)
        return int(f)
    • def numberprint(x):
    • nor = 0
    • final = ''
    • while nor < x:
    • nor += 1
    • final += str(nor)
    • while nor > 1:
    • nor -= 1
    • final += str(nor)
    • return int(final)
    • f = ''
    • for i in range(x):
    • f += str(i)
    • for i in range(x,0,-1):
    • f += str(i)
    • return int(f)
Mathematics
Algorithms
Logic
Numbers
Code
Diff
  • def prime_checker(n):
        if n in [2, 3, 5]:
            return True
        elif n % 2 == 0 or n % 3 == 0 or n % 5 == 0:
            return False
        
        a = int(n ** 0.5 / 30)
        b = [7, 11, 13, 17, 19, 23, 29, 31]
        
        for i in [30 * j for j in range(a + 1)]:
            if True in [n % (i + q) == 0 for q in b if i + q is not n]:
                return False
        return True 
    • """
    • https://en.wikipedia.org/wiki/Primality_test
    • This one has lesser tests or usage of % operator.
    • An alternative using primality mod 30 = 2 * 3 * 5 instead of 6 = 2 * 3
    • """
    • def prime_checker(n):
    • if n in [2, 3, 5]:
    • return True
    • elif n % 2 == 0 or n % 3 == 0 or n % 5 == 0:
    • return False
    • a = int(n ** 0.5 / 30)
    • b = [7, 11, 13, 17, 19, 23, 29, 31]
    • for i in [30 * j for j in range(a + 1)]:
    • if True in [n % (i + q) == 0 for q in b if i + q is not n]:
    • return False
    • return True