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
Fundamentals
Code
Diff
  • def numberprint(x):
        n = ''.join(map(str, range(1,x)))
        return int(f'{n}{x}{n[::-1]}')
    • 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)
    • n = ''.join(map(str, range(1,x)))
    • return int(f'{n}{x}{n[::-1]}')
Code
Diff
  • def meaning_of_life_is():    
        return ord("!") - 33
    • 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
    • """
    • return ord("!") - 33
Code
Diff
  • module ReverseDigs where
    
    revDigs :: Integer -> Integer
    revDigs = read . rev . show
      where
        rev :: [Char] -> [Char]
        rev [] = []
        rev (x:xs) = ((rev xs) ++ [x])
    • public class Algorithms {
    • public static int reverseInt(int n) {
    • int reversed = 0;
    • while(n != 0){
    • reversed = reversed * 10 + (n % 10);
    • n /= 10;
    • }
    • return reversed;
    • }
    • }
    • module ReverseDigs where
    • revDigs :: Integer -> Integer
    • revDigs = read . rev . show
    • where
    • rev :: [Char] -> [Char]
    • rev [] = []
    • rev (x:xs) = ((rev xs) ++ [x])
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
Fundamentals
Numbers
Data Types
Integers
Code
Diff
  • public static class Kata
    {
        public static bool IsOdd(int i) => (i & 1) == 1;
    }
    • public static class Kata
    • {
    • public static bool IsOdd(int input)
    • {
    • return ((input % 10 == 1) || (input % 10 == 3) || (input % 10 == 5) || (input % 10 == 7) || (input % 10 == 9));
    • }
    • public static bool IsOdd(int i) => (i & 1) == 1;
    • }
Code
Diff
  • hello :- write("Hello, Prolog!").
    • System.Console.WriteLine("Hello, C#!");
    • hello :- write("Hello, Prolog!").
Code
Diff
  • function returnhundred() {
      return parseInt((4).toString(2))
    }
    • function returnhundred() {
    • return 10 ** 2;
    • return parseInt((4).toString(2))
    • }
Code
Diff
  • {
      function todo() {
        return 'Walk';
      }
      
      // reescrever em ES6
      {
        function todo() {
          return 'Run';
        }
      };
    }
    • function todo() {
    • return 'Walk';
    • }
    • // reescrever em ES6
    • (function() {
    • {
    • function todo() {
    • return 'Run';
    • return 'Walk';
    • }
    • })();
    • // reescrever em ES6
    • {
    • function todo() {
    • return 'Run';
    • }
    • };
    • }
Code
Diff
  • const materia = {
      conteudo: {
        titulo: 'UOL',
      },
      tags: ['São Paulo', 'SP', 'Sudeste', 'Brasil', 'América Latina']
    };
    
    const [,uf, regiao] = materia.tags;
    const {conteudo:{titulo}} = materia;
    • var materia = {
    • const materia = {
    • conteudo: {
    • titulo: 'UOL',
    • },
    • tags: ['São Paulo', 'SP', 'Sudeste', 'Brasil', 'América Latina']
    • };
    • var uf = materia.tags[1];
    • var regiao = materia.tags[2];
    • var titulo = materia.conteudo.titulo;
    • const [,uf, regiao] = materia.tags;
    • const {conteudo:{titulo}} = materia;
Code
Diff
  • function monteCarlo() {
      return new Promise(function (resolve, reject) {
        resolve([{
          titulo: 'UOL - O Melhor conteúdo'
        }]);
      });
    }
    
    async function main() {
    
      // converter para ES6
      const response = await monteCarlo();
      
      return true;
    }
    • function monteCarlo() {
    • return new Promise(function (resolve, reject) {
    • resolve([{
    • titulo: 'UOL - O Melhor conteúdo'
    • }]);
    • });
    • }
    • async function main() {
    • // converter para ES6
    • monteCarlo().then(function(response) {
    • console.log(response)
    • });
    • const response = await monteCarlo();
    • return true;
    • }