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
  • fn is_odd(input: i32) -> bool {
        input % 2 == 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));
    • }
    • fn is_odd(input: i32) -> bool {
    • input % 2 == 1
    • }
Code
Diff
  • def multiply(a,b):
        
        return a*b
    multiply (5,10)
    print(multiply(5,10))
    
    • def multiply(a,b):
    • result = a*b
    • return result
    • return a*b
    • multiply (5,10)
    • print(multiply(5,10))
Code
Diff
  • function нечетное(число) {
      if (число%2!=0){
        return true
      }
      else {
        return false
      }
    }
    function sumNechet(a, b) {
      let sum=0
      for(slag=a;slag<=b;slag++){
        if (нечетное(slag)){
        sum+=slag
      }
      }
      
      return (sum)          
    }
    
    • function sumNechet(a, b) {
    • }
    • function нечетное(число) {
    • if (число%2!=0){
    • return true
    • }
    • else {
    • return false
    • }
    • }
    • function sumNechet(a, b) {
    • let sum=0
    • for(slag=a;slag<=b;slag++){
    • if (нечетное(slag)){
    • sum+=slag
    • }
    • }
    • }
    • return (sum)
    • }

why not

Code
Diff
  • function rps(player1, player2) {
      const rules = {
        'rock': {
          killer: 'paper'
        },
        'paper': {
          killer: 'scissors'
        },
        'scissors': {
          killer: 'rock'
        },
      };
    
      if (rules[player1].killer === player2) {
        return 'Player 2 won!';
      }
      
      if (rules[player2].killer === player1) {
        return 'Player 1 won!';
      }
      
      return 'Draw!';
    }
    
    • function rps(player1, player2) {
    • return player1 == player2 ? 'Draw!' :
    • player1 == 'rock' && player2 == 'scissors' ||
    • player1 == 'scissors' && player2 == 'paper' ||
    • player1 == 'paper' && player2 == 'rock' ? 'Player 1 won!' : 'Player 2 won!';
    • const rules = {
    • 'rock': {
    • killer: 'paper'
    • },
    • 'paper': {
    • killer: 'scissors'
    • },
    • 'scissors': {
    • killer: 'rock'
    • },
    • };
    • if (rules[player1].killer === player2) {
    • return 'Player 2 won!';
    • }
    • if (rules[player2].killer === player1) {
    • return 'Player 1 won!';
    • }
    • return 'Draw!';
    • }
Code
Diff
  • fn decode(roman: &str) -> i32 {
        let mut number = 0;
        let mut numerals = roman.chars().peekable();
        while let Some(curr) = numerals.next() {
            // if numerals.peek().is_some_and(|&next| value(curr) < value(next)) { // more elegant but currently unstable
            if Some(true) == numerals.peek().map(|&next| value(curr) < value(next)) {
                number -= value(curr);
            } else {
                number += value(curr);
            }
        }
        number
    }
    
    fn value(numeral: char) -> i32 {
        match numeral {
            'I' => 1,
            'V' => 5,
            'X' => 10,
            'L' => 50,
            'C' => 100,
            'D' => 500,
            'M' => 1000,
            _ => panic!("Invalid roman numeral {numeral}"),
        }
    }
    • package kata
    • fn decode(roman: &str) -> i32 {
    • let mut number = 0;
    • let mut numerals = roman.chars().peekable();
    • while let Some(curr) = numerals.next() {
    • // if numerals.peek().is_some_and(|&next| value(curr) < value(next)) { // more elegant but currently unstable
    • if Some(true) == numerals.peek().map(|&next| value(curr) < value(next)) {
    • number -= value(curr);
    • } else {
    • number += value(curr);
    • }
    • }
    • number
    • }
    • func Decode(roman string) int {
    • return 0
    • fn value(numeral: char) -> i32 {
    • match numeral {
    • 'I' => 1,
    • 'V' => 5,
    • 'X' => 10,
    • 'L' => 50,
    • 'C' => 100,
    • 'D' => 500,
    • 'M' => 1000,
    • _ => panic!("Invalid roman numeral {numeral}"),
    • }
    • }
Code
Diff
  • select * from transactions
    order by total_price desc
    • -- Code Here
    • select * from transactions
    • order by total_price desc
Code
Diff
  • const addArr = (arr) => {
      let sum = 0;
      for (let i = 0; i < arr.length; i++) sum += arr[i];
      return sum || null;
    };
    
    • const addArr = (arr) => {
    • let sum = 0;
    • for (let i = 0; i < arr.length; i++) {
    • sum += arr[i];
    • }
    • for (let i = 0; i < arr.length; i++) sum += arr[i];
    • return sum || null;
    • };
Code
Diff
  • should_return_1 = lambda: 1
    • def should_return_1():
    • return 1
    • should_return_1 = lambda: 1
Code
Diff
  • -- Code Here
    select*from transactions
    where customer is not NULL;
    • --- Code Here
    • -- Code Here
    • select*from transactions
    • where customer is not NULL;
Code
Diff
  • -- Code Here
    SELECT * FROM transactions
    WHERE customer IS NOT NULL
    ORDER BY store ASC, total_price DESC;
    • --- Code Here
    • -- Code Here
    • SELECT * FROM transactions
    • WHERE customer IS NOT NULL
    • ORDER BY store ASC, total_price DESC;