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
Functional Programming
Algorithms
Mathematics
Code
Diff
  • const calculateFine = (limit: number) => (speed: number) => {
      const diff = speed - limit;
      if (diff >= 30) return 500;
      if (diff >= 20) return 250;
      if (diff >= 10) return 100;
      return 0;
    }
    
    export const checkIfAtOrBelowLimit = (acceleration: number[], limit: number) => acceleration.map(calculateFine(limit));                
    
    • const calculateFine = (limit: number) => (speed: number) => {
    • if (speed - limit >= 30) return 500;
    • if (speed - limit >= 20) return 250;
    • if (speed - limit >= 10) return 100;
    • const diff = speed - limit;
    • if (diff >= 30) return 500;
    • if (diff >= 20) return 250;
    • if (diff >= 10) return 100;
    • return 0;
    • }
    • export const checkIfAtOrBelowLimit = (acceleration: number[], limit: number): number[] => {
    • return acceleration.map(calculateFine(limit));
    • }
    • export const checkIfAtOrBelowLimit = (acceleration: number[], limit: number) => acceleration.map(calculateFine(limit));
Code
Diff
  • import random
    import string
    
    def cursed_world():
        target = "hello world"
        letters = [random.choice(string.ascii_lowercase + ' ') for _ in range(11)]
    
        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
    
    
    • import random
    • import string
    • def cursed_world():
    • s = ""
    • for i in range(11):
    • s += chr(round((1/362880) * (2206*i**10 - 110153*i**9 + 2354280*i**8 - 28131474*i**7 + 205908150*i**6 - 950715465*i**5 + 2745571940*i**4 - 4732336636*i**3 + 4357651104*i**2 - 1601282592*i + 37739520)))
    • return s
    • target = "hello world"
    • letters = [random.choice(string.ascii_lowercase + ' ') for _ in range(11)]
    • 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

One can just count how many of each letter and union with the minimum letter value.

Code
Diff
  • def duck_duck(a):
        chars = {i: a.count(i) for i in "duck"}
        return chars | {"ducks": min(chars.values())}
    • def duck_duck(a):
    • return
    • chars = {i: a.count(i) for i in "duck"}
    • return chars | {"ducks": min(chars.values())}

Not sure about the use of this but you can also ommit the variable or make a custom function to log the message in a custom way

Code
Diff
  • console.log(6 < 3 ? "ALMOST THERE!" : "yuh gotta wait a little");
    
    
    • const msg = 6 < 3 ? "ALMOST THERE!" : "yuh gotta wait a little";
    • console.log(msg);
    • console.log(6 < 3 ? "ALMOST THERE!" : "yuh gotta wait a little");