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

note that it's not a position, but a move. Otherwise none of the answers are meaningful.

Code
Diff
  • def knight_move3d(position=(0, 0, 0)):
        return sorted(map(abs,position))==[0,1,2]
    • def knight_move3d(position=(0, 0, 0)):
    • cord = [abs(n) for n in position]
    • return 0 in cord and 1 in cord and 2 in cord or cord == position
    • return sorted(map(abs,position))==[0,1,2]
Code
Diff
  • def sus():
        cream, s, ss, sss, i, coffee = [], "sus", "sussy", "amogus", 0, ' '
    
        def among():
            nonlocal cream, i, ss, sss, coffee
            cream.append(s if i % 5 else ss if i % 3 else sss)
            i += 1
            return coffee.join(cream)
        return among
    • def sus():
    • acc=[];s="sus";ss="sussy";sss="amogus";i=0
    • cream, s, ss, sss, i, coffee = [], "sus", "sussy", "amogus", 0, ' '
    • def among():
    • nonlocal acc;nonlocal s;nonlocal i;nonlocal ss;nonlocal sss;acc.append(s if i%5 else ss if i%3 else sss);i+=1
    • return " ".join(acc)
    • nonlocal cream, i, ss, sss, coffee
    • cream.append(s if i % 5 else ss if i % 3 else sss)
    • i += 1
    • return coffee.join(cream)
    • return among
Code
Diff
  • from typing import Any
    
    def where_were_you_when_codewars_died(activity:str, location:str, food_source:Any):
        db = Connection()
        record = f"I was at {location} consuming {food_source} when {activity} died."
        return db.add_record(record)
    
    • def where_were_you_when_codewars_died(activity:str, location:str, food_source:str):
    • from typing import Any
    • def where_were_you_when_codewars_died(activity:str, location:str, food_source:Any):
    • db = Connection()
    • record = f"I was at {location} consuming {food_source} when {activity} died."
    • return db.add_record(record)
Code
Diff
  • using System.Collections.Generic;
    
    public class Kata
    {
        public static bool ContainsCommonItem(char[] a, char[] b)
        {
            if (a == null || b == null) {
                return false;
            }
            
            HashSet<char> setA = new HashSet<char>(a);
            foreach (char item in b)
            {
                if (item != null && setA.Contains(item))
                {
                    return true;
                }
            }
            return false;
        }
    }
    
    • using System.Linq;
    • using System.Collections.Generic;
    • public class Kata
    • {
    • public static bool ContainsCommonItem(char[]a, char[]b) => a?.Any(x => b?.Contains(x) ?? false) ?? false;
    • }
    • public static bool ContainsCommonItem(char[] a, char[] b)
    • {
    • if (a == null || b == null) {
    • return false;
    • }
    • HashSet<char> setA = new HashSet<char>(a);
    • foreach (char item in b)
    • {
    • if (item != null && setA.Contains(item))
    • {
    • return true;
    • }
    • }
    • return false;
    • }
    • }
Code
Diff
  • def pyramid_of_x(n):
        if n < 2:
            return 'Not enough building blocks!'
        rows = ['*' * i for i in range(1, n + 1)]
        return '\n'.join(rows)
    
    • def pyramid_of_x(n):
    • if n < 2:
    • return 'Not enough building blocks!'
    • rows = []
    • for row in range(n):
    • rows.append('*' * (row + 1))
    • rows = ['*' * i for i in range(1, n + 1)]
    • return '\n'.join(rows)