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.
def verify_sum(a, b): if a and b: return sum(map(ord, a)) == sum(map(ord, b))def verifySum(s1, s2):if not s1 or not s2:return Noneelse:return len(s1) == len(s2)- def verify_sum(a, b):
- if a and b:
- return sum(map(ord, a)) == sum(map(ord, b))
test.assert_equals(verify_sum("Sebastian", "Patricia"), False) test.assert_equals(verify_sum("Anna", "Nana"), True) test.assert_equals(verify_sum("John", None), None)test.assert_equals(verifySum("boom", "nope"), True)test.assert_equals(verifySum("", "yes"), None)test.assert_equals(verifySum("yeet", "what?"), False)test.assert_equals(verifySum("spaaaaceeee", " "), True)test.assert_equals(verifySum("Sebastian", "Patricia"), False)test.assert_equals(verifySum("Anna", "Nana"), True)test.assert_equals(verifySum("John", None), None)- test.assert_equals(verify_sum("Sebastian", "Patricia"), False)
- test.assert_equals(verify_sum("Anna", "Nana"), True)
- test.assert_equals(verify_sum("John", None), None)
class fizzbuzz { public static String ts(int num){ if(num % 3 == 0 && num % 5 != 0) return "Fizz"; if(num % 3 != 0 && num % 5 == 0) return "Buzz"; if(num % 3 == 0 && num % 5 == 0) return "FizzBuzz"; return String.valueOf(num); } }def fizzBuzz(num):return 'Fizz' *(not num % 3) + 'Buzz' *(not num % 5) or str(num)- class fizzbuzz {
- public static String ts(int num){
- if(num % 3 == 0 && num % 5 != 0)
- return "Fizz";
- if(num % 3 != 0 && num % 5 == 0)
- return "Buzz";
- if(num % 3 == 0 && num % 5 == 0)
- return "FizzBuzz";
- return String.valueOf(num);
- }
- }
import org.junit.Test; import static org.junit.Assert.assertEquals; import org.junit.runners.JUnit4; public class SolutionTest { @Test public void DivisableByThree() { assertEquals("Fizz", fizzbuzz.ts(3)); assertEquals("Fizz", fizzbuzz.ts(12)); } @Test public void DivisableByFive(){ assertEquals("Buzz", fizzbuzz.ts(5)); assertEquals("Buzz", fizzbuzz.ts(95)); } @Test public void DivisableByThreeAndFive(){ assertEquals("FizzBuzz", fizzbuzz.ts(15)); assertEquals("FizzBuzz", fizzbuzz.ts(90)); } @Test public void NotDivisableByThreeOrFive(){ assertEquals("1", fizzbuzz.ts(1)); assertEquals("7", fizzbuzz.ts(7)); } }test.describe("Divisible By Three")test.assert_equals(fizzBuzz(3), "Fizz")test.assert_equals(fizzBuzz(12), "Fizz")- import org.junit.Test;
- import static org.junit.Assert.assertEquals;
- import org.junit.runners.JUnit4;
test.describe("Divisible By Five")test.assert_equals(fizzBuzz(5), "Buzz")test.assert_equals(fizzBuzz(95), "Buzz")test.describe("Divisible By Three And Five")test.assert_equals(fizzBuzz(15), "FizzBuzz")test.assert_equals(fizzBuzz(90), "FizzBuzz")test.describe("Not Divisible By Three Or Five")test.assert_equals(fizzBuzz(1), "1")test.assert_equals(fizzBuzz(7), "7")- public class SolutionTest {
- @Test
- public void DivisableByThree() {
- assertEquals("Fizz", fizzbuzz.ts(3));
- assertEquals("Fizz", fizzbuzz.ts(12));
- }
- @Test
- public void DivisableByFive(){
- assertEquals("Buzz", fizzbuzz.ts(5));
- assertEquals("Buzz", fizzbuzz.ts(95));
- }
- @Test
- public void DivisableByThreeAndFive(){
- assertEquals("FizzBuzz", fizzbuzz.ts(15));
- assertEquals("FizzBuzz", fizzbuzz.ts(90));
- }
- @Test
- public void NotDivisableByThreeOrFive(){
- assertEquals("1", fizzbuzz.ts(1));
- assertEquals("7", fizzbuzz.ts(7));
- }
- }
highAndLow=a=>Math.max(...a=a.split` `)+` `+Math.min(...a)public class Kumite {public static String highAndLow(String numbers) {String[] integerStrings = numbers.split(" ");int maxValue = Integer.parseInt(integerStrings[0]);int minValue = Integer.parseInt(integerStrings[0]);for (int i = 1; i < integerStrings.length; i++){int number = Integer.parseInt(integerStrings[i]);if(number > maxValue){maxValue = number;}if(number < minValue){minValue = number;}}return Integer.toString(maxValue) + " " + Integer.toString(minValue);}}- highAndLow=a=>Math.max(...a=a.split` `)+` `+Math.min(...a)
describe('tests', () => { Test.assertEquals(highAndLow("1 4 2 6 1 6 1 5 2 8 9"), "9 1") Test.assertEquals(highAndLow("1 4 2 6 -10 6 1 5 2 8 9"), "9 -10") Test.assertEquals(highAndLow("5"), "5 5") Test.assertEquals(highAndLow("-13"), "-13 -13") Test.assertEquals(highAndLow("-42 -15 -16 -23 -8 -4"), "-4 -42") Test.assertEquals(highAndLow("7 2369"), "2369 7") Test.assertEquals(highAndLow("138 2945 78 0 18752 924"), "18752 0") Test.assertEquals(highAndLow("-289 0 289"), "289 -289") })import org.junit.Test;import static org.junit.Assert.assertEquals;import org.junit.runners.JUnit4;// TODO: Replace examples and use TDD development by writing your own testspublic class SolutionTest {@Testpublic void testSomething() {assertEquals("9 1", Kumite.highAndLow("1 4 2 6 1 6 1 5 2 8 9"));assertEquals("9 -10", Kumite.highAndLow("1 4 2 6 -10 6 1 5 2 8 9"));}}- describe('tests', () => {
- Test.assertEquals(highAndLow("1 4 2 6 1 6 1 5 2 8 9"), "9 1")
- Test.assertEquals(highAndLow("1 4 2 6 -10 6 1 5 2 8 9"), "9 -10")
- Test.assertEquals(highAndLow("5"), "5 5")
- Test.assertEquals(highAndLow("-13"), "-13 -13")
- Test.assertEquals(highAndLow("-42 -15 -16 -23 -8 -4"), "-4 -42")
- Test.assertEquals(highAndLow("7 2369"), "2369 7")
- Test.assertEquals(highAndLow("138 2945 78 0 18752 924"), "18752 0")
- Test.assertEquals(highAndLow("-289 0 289"), "289 -289")
- })
yeet_words=t=>t.replace(/\b\w{4,}\b/g,x=>(x<'a'?'Y':'y')+'e'.repeat(x.length-2)+'t')def yeet_words(sentence)yeeted = []for word in sentence.split(' ') donew_word = nill = word.match(/\w+/)[0].lengthif l > 3yeet = 'y' + 'e' * (l - 2) + 't'new_word = word.gsub(/\w+/, yeet)endnew_word = new_word.nil? ? word : new_wordyeeted << new_wordendyeeted.join(' ').capitalize()end- yeet_words=t=>t.replace(/\b\w{4,}\b/g,x=>(x<'a'?'Y':'y')+'e'.repeat(x.length-2)+'t')
describe('test', () => { Test.assertEquals(yeet_words("I like to yeet long words like facetrackingdrone!"), "I yeet to yeet yeet yeeet yeet yeeeeeeeeeeeeeeet!") Test.assertEquals(yeet_words("Yeet yeet yeet yeet yeet. Yeet yeet yeet yeet."), "Yeet yeet yeet yeet yeet. Yeet yeet yeet yeet.") Test.assertEquals(yeet_words("I'm about to yeet, all over this sentence. Hurray!"), "I'm yeeet to yeet, all yeet yeet yeeeeeet. Yeeeet!") })describe "yeet_words" doit "should yeet the sentence" doTest.assert_equals(yeet_words("I like to yeet long words like facetrackingdrone!"), "I yeet to yeet yeet yeeet yeet yeeeeeeeeeeeeeeet!", "NOT YEETED")Test.assert_equals(yeet_words("Yeet yeet yeet yeet yeet yeet yeet yeet yeet."), "Yeet yeet yeet yeet yeet yeet yeet yeet yeet.", "NOT YEETED")Test.assert_equals(yeet_words("I'm about to yeet all over this sentence."), "I'm yeeet to yeet all yeet yeet yeeeeeet.", "NOT YEETED")endend- describe('test', () => {
- Test.assertEquals(yeet_words("I like to yeet long words like facetrackingdrone!"), "I yeet to yeet yeet yeeet yeet yeeeeeeeeeeeeeeet!")
- Test.assertEquals(yeet_words("Yeet yeet yeet yeet yeet. Yeet yeet yeet yeet."), "Yeet yeet yeet yeet yeet. Yeet yeet yeet yeet.")
- Test.assertEquals(yeet_words("I'm about to yeet, all over this sentence. Hurray!"), "I'm yeeet to yeet, all yeet yeet yeeeeeet. Yeeeet!")
- })
Let's golf ;-)