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.
const expect = require('chai').expect describe("testPassword", function() { context("when the password is strong", function() { let password = "Pas$word1"; it("returns true", function () { expect(testPassword(password)).to.be.true; }) }); context("when the password is missing uppercase letters", function() { let password = "all_lower_case!"; it("returns false", function () { expect(testPassword(password)).to.be.false; }) }); context("when the password is missing special charaters", function() { let password = "noSpecialsAllowed"; it("returns false", function () { expect(testPassword(password)).to.be.false; }) }); context("when the password is too short", function() { let password = "Hi!"; it("returns false", function () { expect(testPassword(password)).to.be.false; }) }); });
Test.assertEquals(testPassword("password"), false);Test.assertEquals(testPassword("Pas$word1"), true);Test.assertEquals(testPassword("WodT$m1"), false);- const expect = require('chai').expect
- describe("testPassword", function() {
- context("when the password is strong", function() {
- let password = "Pas$word1";
- it("returns true", function () { expect(testPassword(password)).to.be.true; })
- });
- context("when the password is missing uppercase letters", function() {
- let password = "all_lower_case!";
- it("returns false", function () { expect(testPassword(password)).to.be.false; })
- });
- context("when the password is missing special charaters", function() {
- let password = "noSpecialsAllowed";
- it("returns false", function () { expect(testPassword(password)).to.be.false; })
- });
- context("when the password is too short", function() {
- let password = "Hi!";
- it("returns false", function () { expect(testPassword(password)).to.be.false; })
- });
- });
class Locale { sayHelloTo(whoever){ throw new Error("Not implemented"); } } class EnglishLocale extends Locale { sayHelloTo(whoever){ return `hello ${whoever}`; } } class PirateLocale extends Locale { sayHelloTo(whoever){ return `yar ${whoever}`; } } class BinaryLocale extends EnglishLocale { sayHelloTo(whoever) { let msg = super.sayHelloTo(whoever); return this.txtToBin(msg); } txtToBin(text) { let result = []; for(let character of text){ let binaryArr = this.numberToBinaryArray(character.charCodeAt()); result = result.concat(binaryArr); } return result.join(""); } numberToBinaryArray(number) { let result = []; while(number > 0){ let bit = Math.floor(number % 2) != 0 ? 1 : 0; result.unshift(bit) number = Math.floor(number / 2); } while(result.length != 8) { result.unshift(0); } return result; } } const GREET_LANG = { ENGLISH: new EnglishLocale(), PIRATE: new PirateLocale(), BINARY: new BinaryLocale(), } const hello = (whoever, lang=GREET_LANG.ENGLISH) => lang.sayHelloTo(whoever);
// Declare new languages here and map them in parseGreeting() functionconst GREET_LANG = {ENGLISH: 0,PIRATE: 1,BINARY: 2- class Locale {
- sayHelloTo(whoever){
- throw new Error("Not implemented");
- }
- }
function numberToBinaryArray(number) {let result = [];while(number > 0){let bit = Math.floor(number % 2) != 0 ? 1 : 0;result.unshift(bit)number = Math.floor(number / 2);}while(result.length != 8)result.unshift(0);return result;- class EnglishLocale extends Locale {
- sayHelloTo(whoever){
- return `hello ${whoever}`;
- }
- }
function txtToBin(text) {let result = [];for(let character of text){let binaryArr = numberToBinaryArray(character.charCodeAt());result = result.concat(binaryArr);}return result.join("");- class PirateLocale extends Locale {
- sayHelloTo(whoever){
- return `yar ${whoever}`;
- }
- }
function parseGreeting(lang) {switch(lang){case GREET_LANG.PIRATE:return 'yar';case GREET_LANG.BINARY:return txtToBin('hello');default:return 'hello';- class BinaryLocale extends EnglishLocale {
- sayHelloTo(whoever) {
- let msg = super.sayHelloTo(whoever);
- return this.txtToBin(msg);
- }
}- txtToBin(text) {
- let result = [];
- for(let character of text){
- let binaryArr = this.numberToBinaryArray(character.charCodeAt());
- result = result.concat(binaryArr);
- }
const parseWhoever = (whoever, lang) => lang == GREET_LANG.BINARY ? txtToBin(whoever) : whoever;- return result.join("");
- }
- numberToBinaryArray(number) {
- let result = [];
- while(number > 0){
- let bit = Math.floor(number % 2) != 0 ? 1 : 0;
- result.unshift(bit)
- number = Math.floor(number / 2);
- }
- while(result.length != 8) {
- result.unshift(0);
- }
- return result;
- }
- }
- const GREET_LANG = {
- ENGLISH: new EnglishLocale(),
- PIRATE: new PirateLocale(),
- BINARY: new BinaryLocale(),
- }
const hello = (whoever, lang=GREET_LANG.ENGLISH) => `${parseGreeting(lang)} ${parseWhoever(whoever, lang)}`;- const hello = (whoever, lang=GREET_LANG.ENGLISH) => lang.sayHelloTo(whoever);
describe("Solution", function(){ it("defaults to english", function(){ Test.assertEquals(hello('gotham'), "hello gotham"); }); it("responds in pirate when passed 'pirate' as the language", function(){ Test.assertEquals(hello('gotham', GREET_LANG.PIRATE), "yar gotham"); }); it("responds in real time binary when passed 'binary' as the language", function(){ Test.assertEquals(hello('gotham', GREET_LANG.BINARY), "011010000110010101101100011011000110111100100000011001110110111101110100011010000110000101101101"); }); });
- describe("Solution", function(){
- it("defaults to english", function(){
- Test.assertEquals(hello('gotham'), "hello gotham");
- });
- it("responds in pirate when passed 'pirate' as the language", function(){
- Test.assertEquals(hello('gotham', GREET_LANG.PIRATE), "yar gotham");
- });
it("responds in real time binarry when passed 'binary' as the language", function(){Test.assertEquals(hello('gotham', GREET_LANG.BINARY), "0110100001100101011011000110110001101111 011001110110111101110100011010000110000101101101");- it("responds in real time binary when passed 'binary' as the language", function(){
- Test.assertEquals(hello('gotham', GREET_LANG.BINARY), "011010000110010101101100011011000110111100100000011001110110111101110100011010000110000101101101");
- });
- });