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.
package kata func Multiple3And5(n int) bool { return n - 15 * (n / 15) == 0 }
- package kata
- func Multiple3And5(n int) bool {
return n%3==0 && n%5==0- return n - 15 * (n / 15) == 0
- }
// TODO: replace with your own tests (TDD). An example to get you started is included below. // Ginkgo BDD Testing Framework <http://onsi.github.io/ginkgo/> // Gomega Matcher Library <http://onsi.github.io/gomega/> package kata_test import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "codewarrior/kata" ) func dotest(n int, exp bool) { var ans = Multiple3And5(n) Expect(ans).To(Equal(exp)) } var _ = Describe("Test Example", func() { It("should handle basic cases", func() { dotest(15, true) dotest(30, true) dotest(9, false) dotest(44, false) dotest(81, false) dotest(9015, true) }) })
- // TODO: replace with your own tests (TDD). An example to get you started is included below.
- // Ginkgo BDD Testing Framework <http://onsi.github.io/ginkgo/>
- // Gomega Matcher Library <http://onsi.github.io/gomega/>
- package kata_test
- import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "codewarrior/kata"
- )
- func dotest(n int, exp bool) {
- var ans = Multiple3And5(n)
- Expect(ans).To(Equal(exp))
- }
- var _ = Describe("Test Example", func() {
- It("should handle basic cases", func() {
- dotest(15, true)
- dotest(30, true)
- dotest(9, false)
- dotest(44, false)
- dotest(81, false)
- dotest(9015, true)
- })
- })
class LogicGate: """LogicGate class""" def __init__(self, yin: bool, yang: bool): """Initialize attributes""" self.yin = yin self.yang = yang def logical_and(self):return self.yin and self.yang def logical_or(self):return self.yin or self.yang def logical_xor(self):return (self.yin or self.yang) and (not self.yin or not self.yang) def logical_nand(self):return not self.logical_and() def logical_nor(self):return not self.logical_or() def logical_xnor(self): """This function test for Logical Bi-conditional (XNOR)""" return not self.logical_xor()
- class LogicGate:
- """LogicGate class"""
- def __init__(self, yin: bool, yang: bool):
- """Initialize attributes"""
- self.yin = yin
- self.yang = yang
- def logical_and(self):return self.yin and self.yang
- def logical_or(self):return self.yin or self.yang
- def logical_xor(self):return (self.yin or self.yang) and (not self.yin or not self.yang)
- def logical_nand(self):return not self.logical_and()
def logical_nor(self):"""This function tests for Joint Denial (NOR)"""return not self.logical_or()- def logical_nor(self):return not self.logical_or()
- def logical_xnor(self):
- """This function test for Logical Bi-conditional (XNOR)"""
- return not self.logical_xor()
from math import factorial def get_combination(k: int, n: int) -> int: if k <= 0 or n <= 0:return "n and k must be positive." if n < k:return "n must be greater than or equal to k." return factorial(n) / (factorial(n-k)*factorial(k))
- from math import factorial
- def get_combination(k: int, n: int) -> int:
- if k <= 0 or n <= 0:return "n and k must be positive."
if n < k:return "n must be greater than or equal to k."- if n < k:return "n must be greater than or equal to k."
- return factorial(n) / (factorial(n-k)*factorial(k))