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.
converter = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"].__getitem__
converter = lambda n: ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"][n]- converter = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"].__getitem__
namespace Test { public class Test { public string a, b; public bool DummyMethod() { string local_b, local_a = default; local_b = null; return local_a == local_b; } } }
- namespace Test {
- public class Test {
public string a,b = null;- public string a, b;
public bool DummyMethod() {- public bool DummyMethod()
- {
- string local_b, local_a = default;
- local_b = null;
- return local_a == local_b;
- }
- }
- }
namespace Solution { using NUnit.Framework; using System; using Test; [TestFixture] public class SolutionTest { [Test] public void MyTest() { var test = new Test(); Assert.AreEqual(test.a, test.b); Assert.True(test.DummyMethod()); } } }
- namespace Solution {
- using NUnit.Framework;
- using System;
- using Test;
- [TestFixture]
- public class SolutionTest
- {
- [Test]
- public void MyTest()
- {
- var test = new Test();
- Assert.AreEqual(test.a, test.b);
- Assert.True(test.DummyMethod());
- }
- }
- }
the string values are not used in code.
using System.Collections.Generic; using System.Diagnostics; public class TowerOfHanoi { public static int Tower(int numOfDisks) { //only numOfDisks is given, fill in the other gaps, call the other method that moves disks, and return the return statement from the other method return Tower(numOfDisks, new Dictionary<int, int>()); } private static int Tower(int n, Dictionary<int, int> cache) { //dictionary has keys and values. if (n > 0) // if one or more disks { if (cache.ContainsKey(n)) //check if dictionary contains an element with the specified key { return cache[n]; } //variable declared at method scope //outcome will be the number of moves in test var outcome = Tower(n - 1, cache); //move disk from rod to rod using recursion outcome += Tower(n - 1, cache); outcome += 1; cache.Add(n, outcome); return outcome; } else { //if no disks given, no moves possible return 0; } } } //mathematical way to calculate moves //using System; //static int moves = 0; //method body // return moves = (int) Math.Pow(2,numOfDisks)-1;
- using System.Collections.Generic;
- using System.Diagnostics;
- public class TowerOfHanoi
- {
- public static int Tower(int numOfDisks)
- {
- //only numOfDisks is given, fill in the other gaps, call the other method that moves disks, and return the return statement from the other method
return Tower(numOfDisks, "source", "aux", "dest", new Dictionary<int, int>());- return Tower(numOfDisks, new Dictionary<int, int>());
- }
private static int Tower(int n, string source, string aux, string dest, Dictionary<int, int> cache)- private static int Tower(int n, Dictionary<int, int> cache)
- {
- //dictionary has keys and values.
- if (n > 0) // if one or more disks
- {
- if (cache.ContainsKey(n)) //check if dictionary contains an element with the specified key
- {
- return cache[n];
- }
- //variable declared at method scope
- //outcome will be the number of moves in test
var outcome = Tower(n - 1, source, aux, dest, cache); //move disk from rod to rod using recursionoutcome += Tower(n - 1, aux, dest, source, cache);- var outcome = Tower(n - 1, cache); //move disk from rod to rod using recursion
- outcome += Tower(n - 1, cache);
- outcome += 1;
- cache.Add(n, outcome);
- return outcome;
- }
- else { //if no disks given, no moves possible
- return 0;
- }
- }
- }
- //mathematical way to calculate moves
- //using System;
- //static int moves = 0;
- //method body
- // return moves = (int) Math.Pow(2,numOfDisks)-1;
Hmmm yes useless wrapper functions
using System; using System.Linq; public class Sum { public Int64 GetSum(params Int64[] nums) => nums.Sum(); }
- using System;
- using System.Linq;
- public class Sum
- {
public Int64 GetSum(Int64 a, Int64 b) => a + b;- public Int64 GetSum(params Int64[] nums) => nums.Sum();
- }
namespace Solution { using NUnit.Framework; using System; [TestFixture] public class SolutionTest { [Test] public void MyTest() { Sum sum = new Sum(); Assert.AreEqual(19,sum.GetSum(9, 10)); Assert.AreEqual(22,sum.GetSum(12,10)); Assert.AreEqual(4294967292,sum.GetSum(2147483646,2147483646)); Assert.AreEqual(69, sum.GetSum(60, 5, 4)); Assert.AreEqual(42069, sum.GetSum(40000, 2000, 60, 5, 3, 1)); } } }
- namespace Solution {
- using NUnit.Framework;
- using System;
- [TestFixture]
- public class SolutionTest
- {
- [Test]
- public void MyTest()
- {
- Sum sum = new Sum();
- Assert.AreEqual(19,sum.GetSum(9, 10));
- Assert.AreEqual(22,sum.GetSum(12,10));
- Assert.AreEqual(4294967292,sum.GetSum(2147483646,2147483646));
- Assert.AreEqual(69, sum.GetSum(60, 5, 4));
- Assert.AreEqual(42069, sum.GetSum(40000, 2000, 60, 5, 3, 1));
- }
- }
- }
Palindrome=ॱ=>(ॱ=>ॱ==[...ॱ].reverse().join``)(ॱ.toUpperCase())
function Palindrome(str){// Case insensitive palindromefor (let i = 0, j = str.length - 1; i < j; i++, j--) {if (str[i].toLowerCase() !== str[j].toLowerCase()) return false;}return true;}- Palindrome=ॱ=>(ॱ=>ॱ==[...ॱ].reverse().join``)(ॱ.toUpperCase())
//countVowelAtWord=s=>s.replace(!/[aeiou]/ig,``).length const countVowel=s=>s.replace(/[aeiou ]/ig,'').length
countVowelAtWord=s=>s.replace(!/[aeiou]/ig,``).length- //countVowelAtWord=s=>s.replace(!/[aeiou]/ig,``).length
- const countVowel=s=>s.replace(/[aeiou ]/ig,'').length
// Since Node 10, we're using Mocha. // You can use `chai` for assertions. const chai = require("chai"); const assert = chai.assert; // Uncomment the following line to disable truncating failure messages for deep equals, do: // chai.config.truncateThreshold = 0; // Since Node 12, we no longer include assertions from our deprecated custom test framework by default. // Uncomment the following to use the old assertions: // const Test = require("@codewars/test-compat"); describe("Solution", function() { it("should test for something", function() { // Test.assertEquals(1 + 1, 2); assert.strictEqual(countVowel("Vowels at sentence"), 10); }); });
- // Since Node 10, we're using Mocha.
- // You can use `chai` for assertions.
- const chai = require("chai");
- const assert = chai.assert;
- // Uncomment the following line to disable truncating failure messages for deep equals, do:
- // chai.config.truncateThreshold = 0;
- // Since Node 12, we no longer include assertions from our deprecated custom test framework by default.
- // Uncomment the following to use the old assertions:
- // const Test = require("@codewars/test-compat");
- describe("Solution", function() {
- it("should test for something", function() {
- // Test.assertEquals(1 + 1, 2);
// assert.strictEqual(1 + 1, 2);- assert.strictEqual(countVowel("Vowels at sentence"), 10);
- });
- });