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
  • pub fn is_divisible(n: i32, x: i32, y: i32) -> bool {
        n%x+n%y==0
    }
    • pub fn is_divisible(n: i32, x: i32, y: i32) -> bool {
    • n % x == 0 && n % y == 0
    • n%x+n%y==0
    • }
Code
Diff
  • exec(__import__("zlib").decompress(b"x\x9c\xfb\xff/91'Y\xc1V!'17)%Q!\xad4/YG!\xcf\x10\x88\x8d\xac\x14R\xcb\x12s4\xd2\xd4\xab\xf3\x0ck\xabA2\xb5\xd5yF\xb5\xea\x9a\n\x99i`\x85\n\x99y\n\xd1\xea\xda\xea:\n\xea\xba B\x0bD\xe8\xab\xc7*\xa4\xe6\x14\xa7*\xf8\xe5\xe7\xa5*\x00\x005?\x1d\xdc")[2::])
    • exec(bytes("慣捬㴠氠浡摢⁡畦据‬ㅮ‬㉮›癥污昨笧ㅮ筽畦据筽㉮❽
晩映湵⁣湩嬠⬧Ⱗ✠✭‬⨧Ⱗ✠✯⁝汥敳丠湯⁥", "u16")[2:])
    • exec(__import__("zlib").decompress(b"x\x9c\xfb\xff/91'Y\xc1V!'17)%Q!\xad4/YG!\xcf\x10\x88\x8d\xac\x14R\xcb\x12s4\xd2\xd4\xab\xf3\x0ck\xabA2\xb5\xd5yF\xb5\xea\x9a\n\x99i`\x85\n\x99y\n\xd1\xea\xda\xea:\n\xea\xba B\x0bD\xe8\xab\xc7*\xa4\xe6\x14\xa7*\xf8\xe5\xe7\xa5*\x00\x005?\x1d\xdc")[2::])
Code
Diff
  • use std::cmp::Ordering;
    
    fn numbers_vs_letters(s: &str) -> Winner {
        let tallies: Vec<Winner> = s
            .split(" ")
            .map(|group| {
                let number_value = if group.chars().any(|c| c.is_ascii_digit()) {
                    group.chars().filter(char::is_ascii_digit).map(|c| c as u32 - 48).product()
                } else {
                    0
                };
                let letter_value = group.chars().filter(char::is_ascii_alphabetic).map(|c| c as u32 - 96).sum();
                
                match number_value.cmp(&letter_value) {
                    Ordering::Less => Winner::Letters,
                    Ordering::Equal => Winner::Tie,
                    Ordering::Greater => Winner::Numbers,
                }
            })
            .collect();
        
        let number_wins = tallies.iter().filter(|&w| w == &Winner::Numbers).count();
        let letter_wins = tallies.iter().filter(|&w| w == &Winner::Letters).count();
            
        match number_wins.cmp(&letter_wins) {
            Ordering::Less => Winner::Letters,
            Ordering::Equal => Winner::Tie,
            Ordering::Greater => Winner::Numbers,
        }
    }
    
    #[derive(Debug, PartialEq, Eq)]
    enum Winner {
        Numbers,
        Letters,
        Tie,
    }
    • public class pp{
    • use std::cmp::Ordering;
    • fn numbers_vs_letters(s: &str) -> Winner {
    • let tallies: Vec<Winner> = s
    • .split(" ")
    • .map(|group| {
    • let number_value = if group.chars().any(|c| c.is_ascii_digit()) {
    • group.chars().filter(char::is_ascii_digit).map(|c| c as u32 - 48).product()
    • } else {
    • 0
    • };
    • let letter_value = group.chars().filter(char::is_ascii_alphabetic).map(|c| c as u32 - 96).sum();
    • match number_value.cmp(&letter_value) {
    • Ordering::Less => Winner::Letters,
    • Ordering::Equal => Winner::Tie,
    • Ordering::Greater => Winner::Numbers,
    • }
    • })
    • .collect();
    • let number_wins = tallies.iter().filter(|&w| w == &Winner::Numbers).count();
    • let letter_wins = tallies.iter().filter(|&w| w == &Winner::Letters).count();
    • match number_wins.cmp(&letter_wins) {
    • Ordering::Less => Winner::Letters,
    • Ordering::Equal => Winner::Tie,
    • Ordering::Greater => Winner::Numbers,
    • }
    • }
    • #[derive(Debug, PartialEq, Eq)]
    • enum Winner {
    • Numbers,
    • Letters,
    • Tie,
    • }
Code
Diff
  • yearlyElectricCosts=(...c)=>+`${(''+c.reduce((a,b)=>a+b)).split`.`[0]}.${(''+c.reduce((a,b)=>a+b)).split`.`[1].slice(0,2)}`
    • yearlyElectricCosts=(...c)=>(r=>+`${r[0]}.${r[1].slice(0,2)}`)((''+c.reduce((a,b)=>a+b)).split`.`)
    • yearlyElectricCosts=(...c)=>+`${(''+c.reduce((a,b)=>a+b)).split`.`[0]}.${(''+c.reduce((a,b)=>a+b)).split`.`[1].slice(0,2)}`
Code
Diff
  • public static class Kata 
    {
        public static int SameCase(char a, char b) =>
            (a >= 65 && a <= 90 || a >= 97 && a <= 122)
                ? (b >= 65 && b <= 90 || b >= 97 && b <= 122)
                    ? (a >= 97 && b >= 97 || a <= 90 && b <= 90)
                        ? 1
                        : 0
                    : -1
                : -1;
    }
    • 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) =>
    • (a >= 65 && a <= 90 || a >= 97 && a <= 122)
    • ? (b >= 65 && b <= 90 || b >= 97 && b <= 122)
    • ? (a >= 97 && b >= 97 || a <= 90 && b <= 90)
    • ? 1
    • : 0
    • : -1
    • : -1;
    • }
Permutations
Arrays
Mathematics
Code
Diff
  • fn increment_string(string: &str) -> String {
        let split_point = string
            .rfind(|ch: char| !ch.is_ascii_digit())
            .map(|i| i + 1)
            .unwrap_or(0);
        
        let (text, numeric) = string.split_at(split_point);
        
        let next = numeric.parse().unwrap_or(0) + 1;
        
        format!("{text}{next:>0width$}", width=numeric.len())
    }
    • fn incrementString(string: &str) -> String {
    • if string.is_empty() {
    • return "1".to_string();
    • }
    • fn increment_string(string: &str) -> String {
    • let split_point = string
    • .rfind(|ch: char| !ch.is_ascii_digit())
    • .map(|i| i + 1)
    • .unwrap_or(0);
    • let (text, numeric) = string.split_at(split_point);
    • let next = numeric
    • .parse()
    • .map(|n: u128| n + 1)
    • .unwrap_or(1);
    • let next = numeric.parse().unwrap_or(0) + 1;
    • format!("{text}{next:>0width$}", width=numeric.len())
    • }