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 cat; public class kata{ public static int doubleValue(int x) { return x + x; } }
- package cat;
- public class kata{
- public static int doubleValue(int x) {
return x * 2;- return x + x;
- }
- }
import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import cat.kata.*; // TODO: Replace examples and use TDD by writing your own tests class SolutionTest { @Test void testSomething() { assertEquals(cat.kata.doubleValue(2), 4); assertEquals(cat.kata.doubleValue(-2), -4); } }
- import org.junit.jupiter.api.Test;
- import static org.junit.jupiter.api.Assertions.assertEquals;
- import cat.kata.*;
- // TODO: Replace examples and use TDD by writing your own tests
- class SolutionTest {
- @Test
- void testSomething() {
- assertEquals(cat.kata.doubleValue(2), 4);
- assertEquals(cat.kata.doubleValue(-2), -4);
- }
- }
package kata import ( "fmt" ) func main() { fmt.Println("Hello Golang") }
package main- package kata
- import (
- "fmt"
- )
- func main() {
- fmt.Println("Hello Golang")
- }
// 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" ) var _ = Describe("Test Example", func() { // It("should test that the solution returns the correct value", func() { // Expect(Solution(1)).To(Equal(2)) // }) })
- // 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"
- )
- var _ = Describe("Test Example", func() {
- // It("should test that the solution returns the correct value", func() {
- // Expect(Solution(1)).To(Equal(2))
- // })
- })
RRAYS
The police have placed radars that will detect those vehicles that exceed the speed limit on that road. If the driver's speed is 10km/h to 19km/h above the speed limit, the fine will be 100 $, if it is exceeded by 20km/h to 29km/h the fine will be 250 $ and if it is exceeded by more than 30km/h the fine will be 500 $.
You will be provided with the speed limits of those roads with radar as an collection of integers [90,100,110,120,....] and the speed of the driver will be the same on all roads and can never be negative and the amount of the fine will be accumulated example 95km/h.
Example (Speed=100, Signals=[110,100,80]-> 250$)
public class Kata { public static int speedLimit(int speed, int[] signals) { int penalty = 0; for (int signal : signals) { int diffSpeed = speed - signal; penalty += (diffSpeed > 29) ? 500 : (diffSpeed > 19) ? 250 : (diffSpeed > 9) ? 100 : 0; } return penalty; } }
- public class Kata {
- public static int speedLimit(int speed, int[] signals) {
- int penalty = 0;
- for (int signal : signals) {
final int diff = speed - signal;if (diff >= 30) penalty += 500;else if (diff >= 20) penalty += 250;else if (diff >= 10) penalty += 100;- int diffSpeed = speed - signal;
- penalty += (diffSpeed > 29) ? 500 : (diffSpeed > 19) ? 250 : (diffSpeed > 9) ? 100 : 0;
- }
- return penalty;
- }
- }