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
  • def euler(num):
        return sum(x*(x%3*x%5==0)for x in range(num))
    • def euler(num):
    • return sum([x for x in range(num) if not x % 3 or not x % 5])
    • return sum(x*(x%3*x%5==0)for x in range(num))
Code
Diff
  • namespace Solution 
    {
      using System;
      
      public static class logic
      {
      
        public static bool  Or(bool i, bool j) { return i.i() + j.i() >= 1; }
        public static bool And(bool i, bool j) { return i.i() + j.i() == 2; }
        public static bool Xor(bool i, bool j) { return i.i() + j.i() == 1; }
        
      }
      
      
      public static class BoolExtensions
      {
          public static int i(this bool val)
          {
              return Convert.ToInt32(val);
          }
      }
    }
    • bool Or(bool i, bool j){ return (i+""+j).Contains("T");}
    • bool And(bool i, bool j) {return !(i+""+j).Contains("F");}
    • bool Xor(bool i, bool j){return i.CompareTo(j)*i.CompareTo(j)>0;}
    • namespace Solution
    • {
    • using System;
    • public static class logic
    • {
    • public static bool Or(bool i, bool j) { return i.i() + j.i() >= 1; }
    • public static bool And(bool i, bool j) { return i.i() + j.i() == 2; }
    • public static bool Xor(bool i, bool j) { return i.i() + j.i() == 1; }
    • }
    • public static class BoolExtensions
    • {
    • public static int i(this bool val)
    • {
    • return Convert.ToInt32(val);
    • }
    • }
    • }
  1. Implemented addition-subtraction swap. Unlike the most obvious solution — XOR swap — it works with double.
  2. In Igloo, it's advisable to compare doubles using EqualsWithDelta in lieu of Equals.
Code
Diff
  • #include <algorithm>
    #include <math.h>
    
    template< class T >
    void Swap( T& a, T& b ) 
    {
     	a = a + b;
    	b = a - b;
    	a = a - b;
    }
    • #include <algorithm>
    • #include <math.h>
    • template< class T >
    • void Swap( T& a, T& b ) { std::swap( a, b ); }
    • void Swap( T& a, T& b )
    • {
    • a = a + b;
    • b = a - b;
    • a = a - b;
    • }
Code
Diff
  • const rp = require('request-promise');
    
    async function getUserAllies(username) {
      const html = await rp(`https://www.codewars.com/users/${username}`);
      const [, allies] = html.match(/<div class=\"stat\"><b>Allies:<\/b>(\d+)<\/div>/);
      return +allies;
    }
    • // const request = require('request');
    • // function getUserAllies(username){
    • // return new Promise(function(resolve, reject){
    • // request('https://www.codewars.com/users/'+username, function(err, res, body){
    • // let html = body;
    • // let allies = (html.match(/<div class=\"stat\"><b>Allies:<\/b>(\d+)<\/div>/) || [,'null match'])[1];
    • // resolve(+allies);
    • // });
    • // });
    • // }
    • // using request-promise to avoid wrapping a Promise
    • const rp = require('request-promise');
    • function getUserAllies(username){
    • return new Promise(() => {}); // never resolves
    • }
    • async function getUserAllies(username) {
    • const html = await rp(`https://www.codewars.com/users/${username}`);
    • const [, allies] = html.match(/<div class=\"stat\"><b>Allies:<\/b>(\d+)<\/div>/);
    • return +allies;
    • }
Code
Diff
  • const hello = () => 'world';
    • function hello() {
    • return "world";
    • }
    • const hello = () => 'world';