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
  • import java.util.*;
    /** 
    an object of class blah
    author
    date
    */ 
    class Vehicle {
      
      /**I make up the class invariant, I describe speed limit*/
      final int SPEED_LIMIT = 60; 
      
      /**I make up the class invariant, i describe current speed*/
      int currentSpeed; 
      
      public void setCurrentSpeed(int[] accelerations) {
        currentSpeed = Arrays.stream(accelerations).sum();
      }
      
      /**i describe current speed*/
      public int getCurrentSpeed() {
        return currentSpeed;
      }
      
      /**i describe within speed limit*/
      public boolean isWithinSpeedLimit() {
        return getCurrentSpeed() <= SPEED_LIMIT; 
      }
      
    }
    
    • import java.util.*;
    • /**
    • an object of class blah
    • author
    • date
    • */
    • class Vehicle {
    • /**I make up the class invariant, I describe speed limit*/
    • final int SPEED_LIMIT = 60;
    • /**I make up the class invariant, i describe current speed*/
    • int currentSpeed;
    • /** */
    • public void setCurrentSpeed(int[] accelerations) {
    • currentSpeed = Arrays.stream(accelerations).sum();
    • }
    • /**i describe current speed*/
    • public int getCurrentSpeed() {
    • return currentSpeed;
    • }
    • /**i describe within speed limit*/
    • public boolean isWithinSpeedLimit() {
    • return getCurrentSpeed() <= SPEED_LIMIT;
    • }
    • }

aaaaaaaaaaaaaaaaaaaaaaaaa

Code
Diff
  • unsigned long long div2(unsigned long long a) {
      return a?a/((a/a)+(a/a)):a;
    }
    • unsigned long long div2(unsigned long long a) {
    • return a / 2;
    • return a?a/((a/a)+(a/a)):a;
    • }

I don't think mine is correct since the "golfed" part was the return type.

Code
Diff
  • fn foo()->i8{1}
    • fn foo()->i32{1}
    • fn foo()->i8{1}

Readable

Code
Diff
  • public static class Kata 
    {
      public static int SameCase(char a, char b)
      {
        if (!char.IsLetter(a) || !char.IsLetter(b))
          return -1;
        return char.IsUpper(a) == char.IsUpper(b) ? 1 : 0;
      }
    }
    • public static class Kata
    • {
    • public static int SameCase(char a, char b) =>
    • (!char.IsLetter(a) || !char.IsLetter(b)) ? -1 :
    • (char.IsLower(a) == char.IsLower(b)) ? 1 : 0;
    • public static int SameCase(char a, char b)
    • {
    • if (!char.IsLetter(a) || !char.IsLetter(b))
    • return -1;
    • return char.IsUpper(a) == char.IsUpper(b) ? 1 : 0;
    • }
    • }
Code
Diff
  • fun return_int(i: Int) = i
    • fn return_int(i: i32) -> i32 { i }
    • fun return_int(i: Int) = i

???

Code
Diff
  • Greet=lambda : "".join(map(chr,[x for x in (72,101,108,108,111,32,87,111,114,108,100) if isinstance(x,int)]))
    • function Greet(){return "Hello World!"}
    • Greet=lambda : "".join(map(chr,[x for x in (72,101,108,108,111,32,87,111,114,108,100) if isinstance(x,int)]))
Code
Diff
  • class Human:
        def __init__(self, mouth=None):
            self.mouth = mouth
            self.anus = None
    
        def __str__(self):
            return self.mouth
    
    
    class CentipedeLinkedList:
        def __init__(self):
            self.head = None
    
        def __str__(self):
            return self.head
    
        def display_segments(self):
            body = self.head
            while body is not None:
                print(f'😮️-{body.mouth}💩', end='')
    
                body = body.anus
    
        def insert_new_head(self, new_body):
            NewBody = Human(new_body)
            NewBody.anus = self.head
            self.head = NewBody
    
        def insert_tail(self, new_body):
            NewBody = Human(new_body)
            if self.head is None:
                self.head = NewBody
                return None
            lips = self.head
            while lips.anus:
                lips = lips.anus
            lips.anus = NewBody
    
        def get_count(self):
            temp = self.head
            count = 0
            while temp:
                count += 1
                temp = temp.anus
            return count
        
        
        def search(self, segment):
            temp = self.head
            while temp is not None:
                if segment == temp.mouth:
                    return True
                else:
                    temp = temp.anus
            return False
    
    
    
    • class Human:
    • def __init__(self, mouth=None):
    • self.mouth = mouth
    • self.anus = None
    • def __str__(self):
    • return self.mouth
    • class CentipedeLinkedList:
    • def __init__(self):
    • self.head = None
    • def __str__(self):
    • return self.head
    • def display_segments(self):
    • body = self.head
    • while body is not None:
    • print(f'😮️-{body.mouth}💩', end='')
    • body = body.anus
    • def insert_new_head(self, new_body):
    • NewBody = Human(new_body)
    • NewBody.anus = self.head
    • self.head = NewBody
    • def insert_tail(self, new_body):
    • NewBody = Human(new_body)
    • if self.head is None:
    • self.head = NewBody
    • return None
    • lips = self.head
    • while lips.anus:
    • lips = lips.anus
    • lips.anus = NewBody
    • def main():
    • # Create Human Centipede List:
    • human_centipede = CentipedeLinkedList()
    • # Create centipede body part # 1
    • human_centipede.head = Human('Katsuro')
    • # Create centipede body part # 2
    • jenny = Human('Jenny')
    • # Create centipede body part # 3
    • lindsay = Human('Lindsay')
    • # Linking A to B
    • human_centipede.head.anus = jenny
    • # Linking B to C
    • jenny.anus = lindsay
    • # Display the beautiful three-Node construction!!
    • human_centipede.display_segments()
    • # Add a new head to the Centipede
    • human_centipede.insert_new_head('martin')
    • # Add a new tail to the centipede
    • human_centipede.insert_tail('Karrie')
    • def get_count(self):
    • temp = self.head
    • count = 0
    • while temp:
    • count += 1
    • temp = temp.anus
    • return count
    • def search(self, segment):
    • temp = self.head
    • while temp is not None:
    • if segment == temp.mouth:
    • return True
    • else:
    • temp = temp.anus
    • return False
    • if __name__ == '__main__':
    • main()