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.

Code
Diff
  • def prime(x):
        counter = 0
        for i in range(2, x):
            if x % i is 0:
                return False
        return True
    • def prime(x):
    • counter = 0
    • for i in range(1,x):
    • for i in range(2, x):
    • if x % i is 0:
    • counter += 1
    • if counter is 0:
    • return True
    • else:
    • return False
    • return False
    • return True
Code
Diff
  • public class AbbreviateTwoWords {
    
      public static String abbrevName(String name) {
        return (name.split(" ")[0].charAt(0) + "." + name.split(" ")[1].charAt(0));
      }
    }
    • public class AbbreviateTwoWords {
    • public static String abbrevName(String name) {
    • String[] names = name.split(" ");
    • return (names[0].charAt(0) + "." + names[1].charAt(0)).toUpperCase();
    • return (name.split(" ")[0].charAt(0) + "." + name.split(" ")[1].charAt(0));
    • }
    • }
ES2015
Babel

'Cuase why not :)

Code
Diff
  • /**
     * @param {Number} approximation - number of decimal places you're loojing for. 
     *  Shouldn't exceed 6 as Zu Chongzhi ratio are only valid until first 6 digits.
     *  Is 2 by default.
     */
    const pi = (approximation = 2) =>
      /** Let's use [this guy's](https://en.wikipedia.org/wiki/Zu_Chongzhi) ratio to calc Pi */
      (355 / 113).toFixed(approximation > 2 && approximation <= 6 ? approximation : 2)
    • const pi = () => {
    • }
    • pi()
    • /**
    • * @param {Number} approximation - number of decimal places you're loojing for.
    • * Shouldn't exceed 6 as Zu Chongzhi ratio are only valid until first 6 digits.
    • * Is 2 by default.
    • */
    • const pi = (approximation = 2) =>
    • /** Let's use [this guy's](https://en.wikipedia.org/wiki/Zu_Chongzhi) ratio to calc Pi */
    • (355 / 113).toFixed(approximation > 2 && approximation <= 6 ? approximation : 2)
Code
Diff
  • divisibility_by_3 = lambda x: x // 3 - x / 3 == 0
    • def divisibility_by_3(x):
    • list_of_values = [int(d) for d in str(x)]
    • summation = sum(list_of_values)
    • if summation % 3 == 0:
    • return True
    • else:
    • return False
    • divisibility_by_3 = lambda x: x // 3 - x / 3 == 0
Code
Diff
  • function insertionSort(arr) {
      function sortingValues(a, b) {
        if (a > b) return 1;
        if (a == b) return 0;
        if (a < b) return -1;
      }
      return arr.sort(sortingValues);
    }
    • function insertionSort(arr) {
    • // return sorted array
    • function sortingValues(a, b) {
    • if (a > b) return 1;
    • if (a == b) return 0;
    • if (a < b) return -1;
    • }
    • return arr.sort(sortingValues);
    • }
Code
Diff
  • dividedByThree = lambda n: n % 3 == 0 and n != 0
    • def dividedByThree(number):
    • if number == 0:
    • return False
    • return abs(number) % 3 == 0
    • dividedByThree = lambda n: n % 3 == 0 and n != 0
Code
Diff
  • def unique_in_order(iterable):
        iterable = list(iterable)
        unique = [None]
        for x in iterable:
            if x != unique[-1]:
                unique.append(x)
        return unique[1:]
    • def unique_in_order(iterable):
    • iterable = list(iterable)
    • while 1==1:
    • for x in range(len(iterable)):
    • if iterable[x]==iterable[x-1]:
    • del iterable[x]
    • break
    • if x==len(iterable)-1:
    • return iterable
    • unique = [None]
    • for x in iterable:
    • if x != unique[-1]:
    • unique.append(x)
    • return unique[1:]
Arrays
Data Types
Algorithms
Logic
Data
Code
Diff
  • function pairs(arr) {
      const r = arr.join(' ').match(/-\d/g).filter(i => arr.includes(i[1] / 1)) /1
      return [r,...[Math.abs(r)]]
    }
    • function pairs(arr){
    • let sorted = arr.sort();
    • let length = arr.length;
    • for (let i = 0; i < length; i++) {
    • if (sorted.includes(arr[i] * -1)) {
    • return [sorted[i], sorted[i] * -1];
    • }
    • }
    • function pairs(arr) {
    • const r = arr.join(' ').match(/-\d/g).filter(i => arr.includes(i[1] / 1)) /1
    • return [r,...[Math.abs(r)]]
    • }
Code
Diff
  • class Kata{
      
      public static String verifySum(String nameOne, String nameTwo) {
            if (nameOne == null || nameTwo == null) {
                return "NULL";
            }
    
            
            return nameOne.chars().sum() == nameTwo.chars().sum() ? "TRUE" : "FALSE";
        }
    }
    • class Kata{
    • public static String verifySum(String nameOne, String nameTwo) {
    • int[] sumOfNames = new int[]{0, 0};
    • if (nameOne == null || nameTwo == null) {
    • return "NULL";
    • }
    • for (int i = 0; i < nameOne.length(); i++){
    • sumOfNames[0] += nameOne.charAt(i);
    • }
    • for (int i = 0; i < nameTwo.length(); i++){
    • sumOfNames[1] += nameTwo.charAt(i);
    • }
    • return sumOfNames[0] == sumOfNames[1] ? "TRUE" : "FALSE";
    • return nameOne.chars().sum() == nameTwo.chars().sum() ? "TRUE" : "FALSE";
    • }
    • }
Code
Diff
  • function ok() {
      return ok.name;
    }
    • //return string that says the word ok
    • function ok() {
    • return ok.name;
    • }