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
  • class Component {
      constructor(dom) {
          this.dom = dom;
      }
      
      onCreate() {
        console.log('onCreate from parent class');
        return 'missing';
      }
      
      static on(event, callback) {
        callback();
      }
      
      async emit(event, data) {}
    }
    
    class Title extends Component {
      onCreate(){
        super.onCreate();
        return 'super!';
      }
    }
    
    
    • class Component {
    • constructor(dom) {
    • this.dom = dom;
    • }
    • onCreate() {
    • console.log('onCreate from parent class');
    • return 'missing';
    • }
    • static on(event, callback) {
    • callback();
    • }
    • async emit(event, data) {}
    • }
    • class Title extends Component {
    • onCreate(){
    • super.onCreate();
    • return 'super!';
    • }
    • }
Code
Diff
  • class Component {
      constructor(dom) {
        this.dom = dom;    
      }
      
      onCreate() {
        return this.dom;
      }
    
      
      
    }
    • function Component(dom) {
    • this.dom = dom;
    • this.onCreate = function() {
    • class Component {
    • constructor(dom) {
    • this.dom = dom;
    • }
    • onCreate() {
    • return this.dom;
    • }
    • }
Code
Diff
  • // reescreva usando ES6
    
    var prop = 'myProp';
    
    var obj = {
      [prop]: 123,
    
      myFunc() {
        return this[prop];
      } 
    };
    
    obj.myProp
    • // reescreva usando ES6
    • var prop = 'myProp';
    • var obj = {
    • myFunc: function() {
    • [prop]: 123,
    • myFunc() {
    • return this[prop];
    • }
    • };
    • obj[prop] = 123;
    • obj.myProp
Code
Diff
  • var title = 'UOL - O melhor conteúdo';
    
    var share = {
      fb: {
        title
      },
      twitter: {
        tweet: title
      }
    };
    • var title = 'UOL - O melhor conteúdo';
    • var share = {
    • fb: {
    • title: title
    • title
    • },
    • twitter: {
    • tweet: title
    • }
    • };
Code
Diff
  • // Exercício 1
    const titulo = "UOL - O melhor conteúdo";
    
    
    // Exercício 2
    const tags = []
    
    tags.push(...['A', 'B']);
    
    
    // Exercício 3
    let descricao = "Em 1999";
    
    descricao += " em São Paulo";
    
    
    // Exercício 4
    const materia = {titulo: "Barão de Limeira"};
    
    materia.titulo = "Alameda " + materia.titulo;
    
    
    // Exercício 5
    for (let i = 10; i--;) {
      console.log(i);
    }
    
    
    // Exercício 6
    for (const tag of ['A', 'B']) {
      console.log(tag);
    }
    
    
    // Exercício 7
    for (var j = [].length; j--;) {}
    
    if (j === -1) {
      console.log('Não encontrei');
    }
    
    
    // Exercício 8
    let a = 123;
    
    {
      a *= 2;
    }
    
    console.log(a);
    
    
    // Exercício 9
    let state = 'active';
    
    function stop() {
      state = 'paused';
    }
    
    stop();
    
    
    // Exercício 10
    const TRUE = !0;
    • // Exercício 1
    • var titulo = "UOL - O melhor conteúdo";
    • const titulo = "UOL - O melhor conteúdo";
    • // Exercício 2
    • var tags = []
    • const tags = []
    • tags.push(...['A', 'B']);
    • // Exercício 3
    • var descricao = "Em 1999";
    • let descricao = "Em 1999";
    • descricao += " em São Paulo";
    • // Exercício 4
    • var materia = {titulo: "Barão de Limeira"};
    • const materia = {titulo: "Barão de Limeira"};
    • materia.titulo = "Alameda " + materia.titulo;
    • // Exercício 5
    • for (var i = 10; i--;) {
    • for (let i = 10; i--;) {
    • console.log(i);
    • }
    • // Exercício 6
    • for (var tag of ['A', 'B']) {
    • for (const tag of ['A', 'B']) {
    • console.log(tag);
    • }
    • // Exercício 7
    • for (var j = [].length; j--;) {}
    • if (j === -1) {
    • console.log('Não encontrei');
    • }
    • // Exercício 8
    • var a = 123;
    • let a = 123;
    • {
    • a *= 2;
    • }
    • console.log(a);
    • // Exercício 9
    • var state = 'active';
    • let state = 'active';
    • function stop() {
    • state = 'paused';
    • }
    • stop();
    • // Exercício 10
    • var TRUE = !0;
    • const TRUE = !0;
Fundamentals
Arrays
Data Types
Code
Diff
  • var sum=0;
    const getSum = (array) => {sum=0; array.every( Sum = (curvalue) => {sum+=curvalue; return true; }); return sum;}
    • function getSum(array) {
    • //your code
    • }
    • var sum=0;
    • const getSum = (array) => {sum=0; array.every( Sum = (curvalue) => {sum+=curvalue; return true; }); return sum;}

I wonder what this does?

(defn goes-before? [val1 val2] (<= val1 val2))

;; bubble: list of number -> list of number
;; This was originally racket code, 
;; so it used 'car' and 'cdr' instead of 'first' and 'next'
;; Why can't clojure keep my theming?
(defn bubble [tanks]
  ;; I'm using nested if statements here because I want to use let
  (if (or (nil? tanks) (nil? (next tanks)))
      (cons tanks '(false))
      (let* [truck (first tanks) convoy (next tanks) jeep (first convoy)]
         (if (goes-before? truck jeep)
           (let [debrief (bubble convoy)] (cons (cons truck (first debrief)) (next debrief)))
           (cons (cons jeep (first (bubble (cons truck (next convoy))))) '(true))
           )
        )
      )
  )
  
  ;; bubble-sort: list of number -> list of number
(defn bubble-sort [l]
  (let [bubbly (bubble l)]
    (if (first (next bubbly))
        (bubble-sort (first bubbly))
        (first bubbly)
        )))
        
  (prn (bubble-sort (list 5 4 3 2 1)))
Code
Diff
  • import sys, base64, itertools, functools, types, random, math, inspect
    
    def cursed_world():
        class Omega:
            def __init__(self):
                self.alpha = lambda x: x[::-1]
                self.beta = lambda f: eval(compile(f, '<abyss>', 'exec'))
                self.gamma = lambda s: ''.join(map(chr, s))
                self.delta = lambda b: base64.b64decode(b)
                self.epsilon = lambda: list(itertools.islice(itertools.cycle(range(255)), len("hello world")))
                self.zeta = lambda f: types.FunctionType(f.__code__, globals())
                self.eta = lambda: sum(map(ord, "hello "))
    
            class Alpha:
                def __init__(self):
                    self.secret = [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
                def reveal(self):
                    return ''.join(map(chr, self.secret))
    
        def recursive_symbol(depth):
            if depth <= 0:
                return "hello world"
            else:
                return recursive_symbol(depth - 1)
    
        def byte_alchemy(s):
            b = s.encode()
            transformed = [(x + random.randint(0, 0)) % 256 for x in b]
            return ''.join(map(chr, transformed))
    
        def layered_output(s):
            funcs = [lambda c=c: sys.stdout.write(c) for c in s]
            for f in funcs:
                f()
            sys.stdout.write('\n')
    
        def cryptic_exec():
            code = compile('x="hello world"', '<shadow>', 'exec')
            local_vars = {}
            exec(code, {}, local_vars)
            return local_vars.get("x", "")
    
        def superfluous_math():
            lst = list(range(20))
            total = functools.reduce(lambda a, b: a + (math.sin(b)**2 + math.cos(b)**2), lst, 0)
            return total
    
        def metamorph(x):
            return functools.reduce(lambda a, b: a + b, map(lambda c: chr(c), x))
    
        def chaos_gate():
            return random.choice([True, False])
    
        def hidden_madness():
            nested = [lambda: base64.b64decode(b'aGVsbG8gd29ybGQ=').decode(),
                      lambda: ''.join(chr(x) for x in [104,101,108,108,111,32,119,111,114,108,100]),
                      lambda: recursive_symbol(0)]
            return random.choice(nested)()
    
        omega = Omega()
        alpha = omega.Alpha()
    
        if chaos_gate():
            layered_output(byte_alchemy(base64.b64decode(b'aGVsbG8gd29ybGQ=').decode()))
        else:
            print(cryptic_exec())
    
        extra_noise = superfluous_math()
        hidden = metamorph([ord(c) for c in alpha.reveal()])
        recursive_symbol(0)
        exec(''.join([chr(ord(c)) for c in "pass"]))
    
        illusion = hidden_madness()
        meaningless = omega.gamma([104,101,108,108,111,32,119,111,114,108,100])
        layers = [illusion, meaningless, hidden]
    
        return random.choice(layers)
    cursed_world()
    
    
    
    
    
    #This Is A Certified Bruh Moment
    • import random
    • import string
    • import sys, base64, itertools, functools, types, random, math, inspect
    • def cursed_world():
    • target = "hello world"
    • letters = [random.choice(string.ascii_lowercase + ' ') for _ in range(11)]
    • class Omega:
    • def __init__(self):
    • self.alpha = lambda x: x[::-1]
    • self.beta = lambda f: eval(compile(f, '<abyss>', 'exec'))
    • self.gamma = lambda s: ''.join(map(chr, s))
    • self.delta = lambda b: base64.b64decode(b)
    • self.epsilon = lambda: list(itertools.islice(itertools.cycle(range(255)), len("hello world")))
    • self.zeta = lambda f: types.FunctionType(f.__code__, globals())
    • self.eta = lambda: sum(map(ord, "hello "))
    • generation = 0
    • while True:
    • generation += 1
    • score = sum(letters[i] == target[i] for i in range(11))
    • if score == 11:
    • return "".join(letters)
    • new_letters = letters[:]
    • for i in range(11):
    • if new_letters[i] != target[i]:
    • if random.random() < 0.3:
    • new_letters[i] = random.choice(string.ascii_lowercase + ' ')
    • letters = new_letters
    • class Alpha:
    • def __init__(self):
    • self.secret = [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
    • def reveal(self):
    • return ''.join(map(chr, self.secret))
    • def recursive_symbol(depth):
    • if depth <= 0:
    • return "hello world"
    • else:
    • return recursive_symbol(depth - 1)
    • def byte_alchemy(s):
    • b = s.encode()
    • transformed = [(x + random.randint(0, 0)) % 256 for x in b]
    • return ''.join(map(chr, transformed))
    • def layered_output(s):
    • funcs = [lambda c=c: sys.stdout.write(c) for c in s]
    • for f in funcs:
    • f()
    • sys.stdout.write('\n')
    • def cryptic_exec():
    • code = compile('x="hello world"', '<shadow>', 'exec')
    • local_vars = {}
    • exec(code, {}, local_vars)
    • return local_vars.get("x", "")
    • def superfluous_math():
    • lst = list(range(20))
    • total = functools.reduce(lambda a, b: a + (math.sin(b)**2 + math.cos(b)**2), lst, 0)
    • return total
    • def metamorph(x):
    • return functools.reduce(lambda a, b: a + b, map(lambda c: chr(c), x))
    • def chaos_gate():
    • return random.choice([True, False])
    • def hidden_madness():
    • nested = [lambda: base64.b64decode(b'aGVsbG8gd29ybGQ=').decode(),
    • lambda: ''.join(chr(x) for x in [104,101,108,108,111,32,119,111,114,108,100]),
    • lambda: recursive_symbol(0)]
    • return random.choice(nested)()
    • omega = Omega()
    • alpha = omega.Alpha()
    • if chaos_gate():
    • layered_output(byte_alchemy(base64.b64decode(b'aGVsbG8gd29ybGQ=').decode()))
    • else:
    • print(cryptic_exec())
    • extra_noise = superfluous_math()
    • hidden = metamorph([ord(c) for c in alpha.reveal()])
    • recursive_symbol(0)
    • exec(''.join([chr(ord(c)) for c in "pass"]))
    • illusion = hidden_madness()
    • meaningless = omega.gamma([104,101,108,108,111,32,119,111,114,108,100])
    • layers = [illusion, meaningless, hidden]
    • return random.choice(layers)
    • cursed_world()
    • #This Is A Certified Bruh Moment
Code
Diff
  • def multiply_and_add_one(a: int, b: int) -> int:
        if a == 0:
          t = 0 + 2 /2
        elif b == 0:
          t = 0 + 2 /2
        else:
          a = a + b
          b = b - 0
          t = -1 - -1 * (a * b - b ** 2) + 2
        return t
    • def multiply_and_add_one(a, b):
    • return (a * b) + 1
    • def multiply_and_add_one(a: int, b: int) -> int:
    • if a == 0:
    • t = 0 + 2 /2
    • elif b == 0:
    • t = 0 + 2 /2
    • else:
    • a = a + b
    • b = b - 0
    • t = -1 - -1 * (a * b - b ** 2) + 2
    • return t