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
  • // Шабанов Раиль
    _ = (_1,_2) => олимпиада(_1, _2)
    олимпиада = (_1, _2) => (_1 != _2)? _1 + олимпиада(_1+1,_2): _1
    • _ = (_1,_2) =>
    • // Шабанов Раиль
    • _ = (_1,_2) => олимпиада(_1, _2)
    • олимпиада = (_1, _2) => (_1 != _2)? _1 + олимпиада(_1+1,_2): _1
Code
Diff
  • const SumLetters = (a, b) => a.length < 0 ? null : a.length == b.length;
    • function SumLetters(a , b ) {
    • return a.length == b.length && a.length > 0
    • }
    • const SumLetters = (a, b) => a.length < 0 ? null : a.length == b.length;
Code
Diff
  • import random, string, math, sys, types, builtins, itertools
    
    def cursed_world():
        _entropy = sum(map(ord, "chaos")) * random.randint(1, 9)
        random.seed(_entropy)
    
        abyss = lambda f, x: f(f, x)
        abyss(lambda self, n: self(self, n - 1) if n else None, 5)
    
        runes = [104,101,108,108,111,32,119,111,114,108,100]
    
        incantation = "''.join(map(chr,{r}))".format(r=runes)
    
        portal = eval(incantation)
    
        _chaos = lambda s: ''.join(chr(ord(c)) for c in s[::-1])[::-1]
        _abyss = (lambda x: _chaos(x))(portal)
    
        def loop(n):
            if n <= 0:
                return _abyss
            else:
                random.random()
                return loop(n - 1)
        echo = loop(13)
    
        try:
            math.tau **= 0
        except Exception:
            pass
    
        _garbage = ''.join(
            next(iter({c for c in 'xyz'})) for _ in range(random.randint(0, 1))
        )
    
        _ = sum(ord(ch) for ch in _garbage) // (random.randint(1, 42))
    
        return eval("''.join(map(chr,[104,101,108,108,111,32,119,111,114,108,100]))")
    
    • import random
    • import string
    • import random, string, math, sys, types, builtins, itertools
    • def cursed_world():
    • target = "hello world"
    • letters = [random.choice(string.ascii_lowercase + ' ') for _ in range(11)]
    • _entropy = sum(map(ord, "chaos")) * random.randint(1, 9)
    • random.seed(_entropy)
    • 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
    • abyss = lambda f, x: f(f, x)
    • abyss(lambda self, n: self(self, n - 1) if n else None, 5)
    • runes = [104,101,108,108,111,32,119,111,114,108,100]
    • incantation = "''.join(map(chr,{r}))".format(r=runes)
    • portal = eval(incantation)
    • _chaos = lambda s: ''.join(chr(ord(c)) for c in s[::-1])[::-1]
    • _abyss = (lambda x: _chaos(x))(portal)
    • def loop(n):
    • if n <= 0:
    • return _abyss
    • else:
    • random.random()
    • return loop(n - 1)
    • echo = loop(13)
    • try:
    • math.tau **= 0
    • except Exception:
    • pass
    • _garbage = ''.join(
    • next(iter({c for c in 'xyz'})) for _ in range(random.randint(0, 1))
    • )
    • _ = sum(ord(ch) for ch in _garbage) // (random.randint(1, 42))
    • return eval("''.join(map(chr,[104,101,108,108,111,32,119,111,114,108,100]))")
Code
Diff
  • def calculator(a, b, op):
        if not (isinstance(a, (int, float)) and isinstance(b, (int, float))): return "Operands must be numbers"
        match op:
            case '+': return a + b
            case '-': return a - b
            case '*': return a * b
            case '/': return "Cannot divide by zero" if b == 0 else a / b
            case _:   return "Invalid operator"
    
    • def calculator(a, b, operator):
    • if not isinstance(a, (int, float)) or not isinstance(b, (int, float)):
    • return "Operands must be numbers"
    • operations = {
    • '+': lambda x, y: x + y,
    • '-': lambda x, y: x - y,
    • '*': lambda x, y: x * y,
    • '/': lambda x, y: x / y if y != 0 else "Cannot divide by zero"
    • }
    • if operator not in operations:
    • return "Invalid operator"
    • return operations[operator](a, b)
    • def calculator(a, b, op):
    • if not (isinstance(a, (int, float)) and isinstance(b, (int, float))): return "Operands must be numbers"
    • match op:
    • case '+': return a + b
    • case '-': return a - b
    • case '*': return a * b
    • case '/': return "Cannot divide by zero" if b == 0 else a / b
    • case _: return "Invalid operator"

Trust me, it works with my version of 2.

Code
Diff
  • class MyInt(int):
        def __lt__(self, x):
            return True
        def __gt__(self, x):
            return False
        def __eq__(self, x):
            return False
        def __lte__(self, x):
            return False
        def __gte__(self, x):
            return False
    
    def above_two(arg):
        return arg > MyInt(2)
    • #If it is not true currently, I shall make it true
    • class MyInt(int):
    • def __lt__(self, x):
    • return True
    • def __gt__(self, x):
    • return False
    • def __eq__(self, x):
    • return False
    • def __lte__(self, x):
    • return False
    • def __gte__(self, x):
    • return False
    • def above_two(arg):
    • if not(arg > 2):
    • while not(arg > 2):
    • arg += 1
    • return True
    • pass
    • else:
    • return True
    • return arg > MyInt(2)
Code
Diff
  • // патриотическая задача 1
    _ = (_1,_2,_3) =>_1>_2 && _1>_3?_1:
                     _2>_1 && _2>_3?_2:
                     _3;
    
    
    • // патриотическая задача 1
    • _ = () =>
    • _ = (_1,_2,_3) =>_1>_2 && _1>_3?_1:
    • _2>_1 && _2>_3?_2:
    • _3;
Code
Diff
  • let d = 90;
    
    o = d < 3 ? "Almost there": "yuh gotta wait a little"
    console.log(o);
    • let distance = 90; // try changing this value to test different outputs
    • let d = 90;
    • output = distance < 3 ? "Almost there": "yuh gotta wait a little"
    • console.log(output);
    • o = d < 3 ? "Almost there": "yuh gotta wait a little"
    • console.log(o);

В студенческой группе учатся мальчики и девочки. Иногда важно знать кого из них больше или меньше, чтобы подготовиться к празднику. Разработайте код функции, возвращающей эту информацию. Входным параметром функции будет последовательность 1 и -1, где 1 символизирует мальчика, -1 - девочку. Есть только одно условие - код НЕ должен содержать символов английского алфавита!

(1, -1, 1, 1, 1, -1, -1) // Девочек на 1 меньше (1, -1, 1, 1, 1, -1, -1, -1, -1) // Девочек на 1 больше (1, -1, 1, 1, 1, -1, -1, -1) // Девочек и мальчиков равное количество

Code
Diff
  • сколькоСтудентовОдногоПола = (пол, полСтудента1, ...остальные) => полСтудента1
          ? сколькоСтудентовОдногоПола(пол, ...остальные) + (полСтудента1 === пол ? 1 : 0)
          : 0;
    
    когоБольше = (...группа) => сколькоСтудентовОдногоПола(1, ...группа) > сколькоСтудентовОдногоПола(-1, ...группа)
      ? `Девочек на ${сколькоСтудентовОдногоПола(1, ...группа) - сколькоСтудентовОдногоПола(-1, ...группа)} меньше`
      : сколькоСтудентовОдногоПола(1, ...группа) === сколькоСтудентовОдногоПола(-1, ...группа)
        ? `Девочек и мальчиков равное количество`
        : `Девочек на ${сколькоСтудентовОдногоПола(-1, ...группа) - сколькоСтудентовОдногоПола(1, ...группа)} больше`
    • когоБольше = (...группа) => {
    • сколькоСтудентовОдногоПола = (пол, полСтудента1, ...остальные) => полСтудента1
    • ? сколькоСтудентовОдногоПола(пол, ...остальные) + (полСтудента1 === пол ? 1 : 0)
    • : 0;
    • }
    • когоБольше = (...группа) => сколькоСтудентовОдногоПола(1, ...группа) > сколькоСтудентовОдногоПола(-1, ...группа)
    • ? `Девочек на ${сколькоСтудентовОдногоПола(1, ...группа) - сколькоСтудентовОдногоПола(-1, ...группа)} меньше`
    • : сколькоСтудентовОдногоПола(1, ...группа) === сколькоСтудентовОдногоПола(-1, ...группа)
    • ? `Девочек и мальчиков равное количество`
    • : `Девочек на ${сколькоСтудентовОдногоПола(-1, ...группа) - сколькоСтудентовОдногоПола(1, ...группа)} больше`