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.
qwe
const rps=(a, b)=>a==b?'Draw!':'Player '+(['scissorsrock','paperscissors','rockpaper'].includes(a+b)+1)+' won!';
function rps(player1, player2) {return player1 == player2 ? 'Draw!' :player1 == 'rock' && player2 == 'scissors' ||player1 == 'scissors' && player2 == 'paper' ||player1 == 'paper' && player2 == 'rock' ? 'Player 1 won!' : 'Player 2 won!';}- const rps=(a, b)=>a==b?'Draw!':'Player '+(['scissorsrock','paperscissors','rockpaper'].includes(a+b)+1)+' won!';
const numMinusSeven = num => { let youGoodBro = []; while (num > 0) youGoodBro.push(num -= 7); return youGoodBro.length; }
const numMinusSeven = function(num) {- const numMinusSeven = num => {
- let youGoodBro = [];
while (num > 0) {num -= 7;youGoodBro.push(num);}- while (num > 0) youGoodBro.push(num -= 7);
- return youGoodBro.length;
- }
fun sum(array: IntArray) = array.reduce { sum, element -> sum + element }
def sum(arr):result = 0for i in arr:result += ireturn result- fun sum(array: IntArray) = array.reduce { sum, element -> sum + element }
import kotlin.test.assertEquals import org.junit.Test class TestExample { @Test fun `Basic test`() { assertEquals(sum(intArrayOf(1)), 1) assertEquals(sum(intArrayOf(1, 2, 3)), 6) } }
import codewars_test as test# TODO Write testsfrom solution import sum- import kotlin.test.assertEquals
- import org.junit.Test
# test.assert_equals(actual, expected, [optional] message)@test.describe("Example tests")def test_group():@test.it("Basic tests")def test_case():test.assert_equals(sum([1]), 1)test.assert_equals(sum([1,2,3]), 6)- class TestExample {
- @Test
- fun `Basic test`() {
- assertEquals(sum(intArrayOf(1)), 1)
- assertEquals(sum(intArrayOf(1, 2, 3)), 6)
- }
- }
using System.Collections.Generic; using System.Linq; public class Kata { /// <summary> /// Checks if two char arrays contain at least one common item. /// </summary> /// <param name="a">First char array</param> /// <param name="b">Second char array</param> /// <returns>True if the arrays have at least one common item, false otherwise</returns> public static bool ContainsCommonItem(char[] a, char[] b) => (a == null || b == null) ? false : a.Intersect(b).Any();
- using System.Collections.Generic;
- using System.Linq;
- public class Kata
- {
- /// <summary>
- /// Checks if two char arrays contain at least one common item.
- /// </summary>
- /// <param name="a">First char array</param>
- /// <param name="b">Second char array</param>
- /// <returns>True if the arrays have at least one common item, false otherwise</returns>
public static bool ContainsCommonItem(char[] a, char[] b){// If either input array is null, return falseif (a == null || b == null) return false;- public static bool ContainsCommonItem(char[] a, char[] b) => (a == null || b == null) ? false : a.Intersect(b).Any();
return a.Intersect(b).Any();}}
def solution(roman): roman_numbers = { 'I': 1, 'II': 2, 'III': 3, 'IV': 4, 'V': 5, 'VI': 6, 'VII': 7, 'VIII': 8, 'IX': 9, 'X': 10, 'XL': 40, 'L': 50, 'XC': 90, 'C': 100, 'CD': 400, 'D': 500, 'CM': 900, 'M': 1000, } n = 0 i = len(roman) while roman: s = roman[: i + 1] d = roman_numbers.get(s) if d: n += d roman = roman[i + 1 :] i = len(roman) else: i -= 1 return n
package kata- def solution(roman):
- roman_numbers = {
- 'I': 1,
- 'II': 2,
- 'III': 3,
- 'IV': 4,
- 'V': 5,
- 'VI': 6,
- 'VII': 7,
- 'VIII': 8,
- 'IX': 9,
- 'X': 10,
- 'XL': 40,
- 'L': 50,
- 'XC': 90,
- 'C': 100,
- 'CD': 400,
- 'D': 500,
- 'CM': 900,
- 'M': 1000,
- }
- n = 0
- i = len(roman)
- while roman:
- s = roman[: i + 1]
- d = roman_numbers.get(s)
- if d:
- n += d
- roman = roman[i + 1 :]
- i = len(roman)
- else:
- i -= 1
- return n
func Decode(roman string) int {return 0}
test.describe("Example Tests") test.assert_equals(solution('XXI'), 21, 'XXI should == 21') test.assert_equals(solution('I'), 1, 'I should == 1') test.assert_equals(solution('IV'), 4, 'IV should == 4') test.assert_equals(solution('MMVIII'), 2008, 'MMVIII should == 2008') test.assert_equals(solution('MDCLXVI'), 1666, 'MDCLXVI should == 1666')
package kata_testimport (. "github.com/onsi/ginkgo". "github.com/onsi/gomega". "codewarrior/kata")var _ = Describe("test roman to decimal converter", func() {It("should give decimal number from roman", func() {Expect(Decode("XXI")).To(Equal(21))})It("should give decimal number from roman", func() {Expect(Decode("I")).To(Equal(1))})It("should give decimal number from roman", func() {Expect(Decode("IV")).To(Equal(4))})It("should give decimal number from roman", func() {Expect(Decode("MMVIII")).To(Equal(2008))})It("should give decimal number from roman", func() {Expect(Decode("MDCLXVI")).To(Equal(1666))})})- test.describe("Example Tests")
- test.assert_equals(solution('XXI'), 21, 'XXI should == 21')
- test.assert_equals(solution('I'), 1, 'I should == 1')
- test.assert_equals(solution('IV'), 4, 'IV should == 4')
- test.assert_equals(solution('MMVIII'), 2008, 'MMVIII should == 2008')
- test.assert_equals(solution('MDCLXVI'), 1666, 'MDCLXVI should == 1666')
const addArr = (arr) => arr?.length ? arr.reduce((sum, num) => sum + num, 0) : null;
function addArr(arr){if(arr.length === 0) return nulllet final = 0arr.forEach(num => {final += num})return final}- const addArr = (arr) => arr?.length ? arr.reduce((sum, num) => sum + num, 0) : null;
const chai = require("chai"); const assert = chai.assert; describe("Solution", function() { it("should test for something", function() { assert.strictEqual(addArr([1, 2, 3, 4, 5]), 15); assert.strictEqual(addArr([1, 100]), 101) assert.strictEqual(addArr([]), null) }); });
- const chai = require("chai");
- const assert = chai.assert;
- describe("Solution", function() {
- it("should test for something", function() {
- assert.strictEqual(addArr([1, 2, 3, 4, 5]), 15);
- assert.strictEqual(addArr([1, 100]), 101)
- assert.strictEqual(addArr([]), null)
- });
- });