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
  • function rgbToHsv(rgb) {
      let [r, g, b] = rgb;
      const v = Math.max(r, g, b) / 255;
      if (v == 0) return Array.of(0, 0, 0);
      r /= v, g /= v, b /= v;
      const s = 1 - Math.min(r, g, b) / 255;
      if (s == 0) return Array.of(0, 0, v * 100);
      r = 255 - (255 - r) / s;
      g = 255 - (255 - g) / s;
      b = 255 - (255 - b) / s;
      const peak = Math.max(r, g, b);
      let h = 0;
      if (r == peak) h = g < b ? 360 - b * 60 / 255 : g * 60 / 255;
      else if (g == peak) h = r > b ? 120 - r * 60 / 255 : 120 + b * 60 / 255;
      else h = r > g ? 240 + r * 60 / 255 : 240 - g * 60 / 255;
      return Array.of(Math.round(h), Math.round(s * 100), Math.round(v * 100));
    }
    • function rgbToHsv(rgb) {
    • let r = rgb[0], g = rgb[1], b = rgb[2];
    • let [r, g, b] = rgb;
    • const v = Math.max(r, g, b) / 255;
    • if (v == 0) return Array.of(0, 0, 0);
    • r /= v;
    • g /= v;
    • b /= v;
    • r /= v, g /= v, b /= v;
    • const s = 1 - Math.min(r, g, b) / 255;
    • if (s == 0) return Array.of(0, 0, v * 100);
    • r = 255 - (255 - r) / s;
    • g = 255 - (255 - g) / s;
    • b = 255 - (255 - b) / s;
    • const peak = Math.max(r, g, b);
    • let h = 0;
    • if (r == peak) h = g < b ? 360 - b * 60 / 255 : g * 60 / 255;
    • else if (g == peak) h = r > b ? 120 - r * 60 / 255 : 120 + b * 60 / 255;
    • else h = r > g ? 240 + r * 60 / 255 : 240 - g * 60 / 255;
    • return Array.of(Math.round(h), Math.round(s * 100), Math.round(v * 100));
    • }
Sets
Code
Diff
  • def NotDumbRockPaperScissors(player1, player2):
        rock = {"paper"}
        paper = {"scissors"}
        scissors = {"rock"}
        # set variable names to lowercase
        if player1.lower() in eval(player2.lower()):
            return "Player 1 wins"
        elif player2.lower() in eval(player1.lower()):
            return "Player 2 wins"
        # converted the input args into lowercase for more consistent comparisons
        else:
            return "Draw"
     
    
    • def dumbRockPaperScissors(player1, player2):
    • Rock = {"Paper"}
    • Paper = {"Scissors"}
    • Scissors = {"Rock"}
    • if player1 in eval(player2):
    • def NotDumbRockPaperScissors(player1, player2):
    • rock = {"paper"}
    • paper = {"scissors"}
    • scissors = {"rock"}
    • # set variable names to lowercase
    • if player1.lower() in eval(player2.lower()):
    • return "Player 1 wins"
    • elif player2 in eval(player1):
    • elif player2.lower() in eval(player1.lower()):
    • return "Player 2 wins"
    • # converted the input args into lowercase for more consistent comparisons
    • else:
    • return "Draw"
Code
Diff
  • use std::collections::BTreeSet;
    
    fn first_non_repeating_character(s: &str) -> Option<char> {
        let mut seen = Vec::new();
        let mut repeated = BTreeSet::new();
        for c in s.chars() {
            if repeated.contains(&c) {
                continue;
            }
            if let Some(idx) = seen.iter().position(|&ch| ch == c) {
                seen.remove(idx);
                repeated.insert(c);
            } else {
                seen.push(c);
            }
        }
        seen.first().copied()
        
    }
    • const firstNonRepeatingCharacter = (str) => {
    • for (let i = 0; i < str.length; i++) {
    • let seenDuplicate = false;
    • for (let j = 0; j < str.length; j++) {
    • if (str[i] === str[j] && i !== j) {
    • seenDuplicate = true;
    • break;
    • }
    • use std::collections::BTreeSet;
    • fn first_non_repeating_character(s: &str) -> Option<char> {
    • let mut seen = Vec::new();
    • let mut repeated = BTreeSet::new();
    • for c in s.chars() {
    • if repeated.contains(&c) {
    • continue;
    • }
    • if (!seenDuplicate) {
    • return str[i];
    • if let Some(idx) = seen.iter().position(|&ch| ch == c) {
    • seen.remove(idx);
    • repeated.insert(c);
    • } else {
    • seen.push(c);
    • }
    • }
    • return null; // return null if no unique character is found
    • };
    • seen.first().copied()
    • }
Code
Diff
  • def multiply(a,b):
        return a*b
    
    result = multiply(5,10)
    print(result)
    
    • from math import prod
    • def multiply(a,b):
    • return a*b
    • def multiply(a, b):
    • ints = (a, b)
    • return prod(ints)
    • result = multiply(5, 10)
    • result = multiply(5,10)
    • print(result)
Code
Diff
  • function sum(a,b) {
      return +a + +b; // Now works for strings
    }
    • function sum(a,b) {
    • return a+b; // wrong returning
    • return +a + +b; // Now works for strings
    • }
Code
Diff
  • const nums = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
    const digitToText = nums.at.bind(nums) ?? 'idk'
    • const nums = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
    • function digitToText(digit) {
    • return nums[digit]
    • }
    • const digitToText = nums.at.bind(nums) ?? 'idk'
Code
Diff
  • const cinema_auditorium = (spisok2D,ryad)=> {
      var output = (spisok2D[ryad].reduce((summaStulev,stulya ) => summaStulev + stulya, 0));
      console.log(output);
      var stulya = spisok2D[ryad].reduce((summaStulev,stulya ) => summaStulev + stulya, 0);
      return stulya;
    }
    • const cinema_auditorium = (spisok2D,ryad)=> {
    • console.log(spisok2D,ryad)
    • return 3
    • var output = (spisok2D[ryad].reduce((summaStulev,stulya ) => summaStulev + stulya, 0));
    • console.log(output);
    • var stulya = spisok2D[ryad].reduce((summaStulev,stulya ) => summaStulev + stulya, 0);
    • return stulya;
    • }