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

best solution

Code
Diff
  • fun main() = print("Hi")
    • fun main() = print("Hello world")
    • fun main() = print("Hi")
Code
Diff
  • is_even = lambda x: not(x % 2)
    • is_even = lambda x: not(x & 1)
    • is_even = lambda x: not(x % 2)
Code
Diff
  • is_divisible = lambda n, x, y: not n % x and not n % y
    
    • is_divisible = lambda n,x,y:n%x==n%y
    • is_divisible = lambda n, x, y: not n % x and not n % y
Code
Diff
  • is_equal=lambda a,b: ['yes', 'no'][bool(a) ^ bool(b)]
    • is_equal=lambda a,b:'yes'if a==b else'no'
    • is_equal=lambda a,b: ['yes', 'no'][bool(a) ^ bool(b)]
Code
Diff
  • class Human {
        #name;
        #surname;
        #birthday;  
      
        constructor ( name = 'Jhon', surname = 'Doe' , birthday = new Date().toISOString().split`T`[0]) {
            this.#name = name
            this.#surname = surname
            this.#birthday = birthday
        }
      
        get name () {
            return this.#name
        }
      
        get surname () {
            return this.#surname
        }
        
        set name ( newName = 'Jhon' ) {
            this.#name = newName
        }
        
        set surname ( newSurname = 'Doe' ) {
            this.#surname = newSurname
        }
      
        get birthday () {
           return this.#birthday
        }
      
        getAge () {
            return `I'm ${(new Date() - new Date(this.#birthday))/1000/60/60/24/365|0} years old`
        }
      
        greeting () {
            return `Hello, my name is ${this.#name} ${this.#surname}`
        }
      
    }
    
    class Worker extends Human {
        #totalDays = 0
        #hoursPerWeek = 0
        #profession;
      
        constructor( name, surname, profession = 'Developer' ){
            super()
            super.name = name
            super.surname = surname
            this.#profession = profession
        }
      
        get profession () {
          return this.#profession
        }
    
        get stats () {
            return {
                totalDays: this.#totalDays,
                hoursPerWeek: this.#hoursPerWeek
            }
        }
      
        doWork (hours = 8) {
            if (!(this.#totalDays % 7) && this.#totalDays) 
                this.#hoursPerWeek = hours
            this.#hoursPerWeek += hours
            this.#totalDays += 1
            return this
        }
      
        changeProfession ( newProfession ) {
          if ( !newProfession ) throw Error('The profession was not transferred!')
          if ( typeof newProfession !== 'string' ) throw TypeError('Incorrect new profession type!')
          this.#profession = newProfession
          this.#hoursPerWeek = 0
          this.#totalDays = 0
          return this
        }
      
    }
    • class Human {
    • #name;
    • #surname;
    • constructor ( name = 'Jhon', surname = 'Doe' ) {
    • #birthday;
    • constructor ( name = 'Jhon', surname = 'Doe' , birthday = new Date().toISOString().split`T`[0]) {
    • this.#name = name
    • this.#surname = surname
    • this.#birthday = birthday
    • }
    • get name () {
    • return this.#name
    • }
    • get surname () {
    • return this.#surname
    • }
    • set name ( newName = 'Jhon' ) {
    • this.#name = newName
    • }
    • set surname ( newSurname = 'Doe' ) {
    • this.#surname = newSurname
    • }
    • get birthday () {
    • return this.#birthday
    • }
    • getAge () {
    • return `I'm ${(new Date() - new Date(this.#birthday))/1000/60/60/24/365|0} years old`
    • }
    • greeting () {
    • return `Hello, my name is ${this.#name} ${this.#surname}`
    • }
    • }
    • class Worker extends Human {
    • #totalDays = 0
    • #hoursPerWeek = 0
    • #profession;
    • constructor( name, surname, profession = 'Developer' ){
    • super()
    • super.name = name
    • super.surname = surname
    • this.#profession = profession
    • }
    • get profession () {
    • return this.#profession
    • }
    • get stats () {
    • return {
    • totalDays: this.#totalDays,
    • hoursPerWeek: this.#hoursPerWeek
    • }
    • }
    • doWork (hours = 8) {
    • if (!(this.#totalDays % 7) && this.#totalDays)
    • this.#hoursPerWeek = hours
    • this.#hoursPerWeek += hours
    • this.#totalDays += 1
    • return this
    • }
    • changeProfession ( newProfession ) {
    • if ( !newProfession ) throw Error('The profession was not transferred!')
    • if ( typeof newProfession !== 'string' ) throw TypeError('Incorrect new profession type!')
    • this.#profession = newProfession
    • this.#hoursPerWeek = 0
    • this.#totalDays = 0
    • return this
    • }
    • }