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.
using System; class Kata { public static void Main(string greeting, string language) { Console.WriteLine("{0}, {1}!", greeting, language); } }
- using System;
- class Kata {
- public static void Main(string greeting, string language) {
Console.WriteLine($"{greeting}, {language}!");- Console.WriteLine("{0}, {1}!", greeting, language);
- }
- }
module NCR where --Combinations nCr comb:: Integer -> Integer -> Integer comb n r = factorial n `div` (factorial r * factorial (n-r)) where factorial n = foldr (*) 1 [2..n]
- module NCR where
- --Combinations nCr
- comb:: Integer -> Integer -> Integer
comb n r | n/=r = (factorial n) `div` (factorial r * factorial (n-r) )| n==r = (factorial n) `div` (factorial r)factorial n= foldl (*) 1 [1..n]- comb n r = factorial n `div` (factorial r * factorial (n-r))
- where
- factorial n = foldr (*) 1 [2..n]
Allow for passing parents into the constructor. Also, add some spaces to make code consistent. Also, avoid mutating parents array, just for the sake of it.
class Human { constructor (firstName = '', lastName = '', parents = []) { this.firstName = firstName; this.lastName = lastName; this.parents = parents; // modern family. who takes parental care? } filterMyFamily(humans) { return humans.filter(human => human.lastName === this.lastName) } hasParent(p) { return this.parents.some(parent => parent === p); } hasChild(c) { return c.hasParent(this); } addParent(p) { if (!this.hasParent(p)) this.parents = [ ...this.parents, p ]; return this; } }
- class Human {
constructor (firstName = '', lastName = '') {- constructor (firstName = '', lastName = '', parents = []) {
- this.firstName = firstName;
- this.lastName = lastName;
this.parents = []; // modern family. who takes parental care?- this.parents = parents; // modern family. who takes parental care?
- }
- filterMyFamily(humans) {
- return humans.filter(human => human.lastName === this.lastName)
- }
addParent(p){if (!this.hasParent(p)) this.parents.push(p);return this;- hasParent(p) {
- return this.parents.some(parent => parent === p);
- }
hasChild(c){- hasChild(c) {
- return c.hasParent(this);
- }
hasParent(p){return this.parents.some(parent => parent === p);- addParent(p) {
- if (!this.hasParent(p)) this.parents = [ ...this.parents, p ];
- return this;
- }
- }