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.
// Exercício 1 const titulo = "UOL - O melhor conteúdo"; // Exercício 2 const tags = [] tags.push(...['A', 'B']); // Exercício 3 let descricao = "Em 1999"; descricao += " em São Paulo"; // Exercício 4 const materia = {titulo: "Barão de Limeira"}; materia.titulo = "Alameda " + materia.titulo; // Exercício 5 for (let i = 10; i--;) { console.log(i); } // Exercício 6 for (const tag of ['A', 'B']) { console.log(tag); } // Exercício 7 for (var j = [].length; j--;) {} if (j === -1) { console.log('Não encontrei'); } // Exercício 8 let a = 123; { a *= 2; } console.log(a); // Exercício 9 let state = 'active'; function stop() { state = 'paused'; } stop(); // Exercício 10 const TRUE = !0;
- // Exercício 1
var titulo = "UOL - O melhor conteúdo";- const titulo = "UOL - O melhor conteúdo";
- // Exercício 2
var tags = []- const tags = []
- tags.push(...['A', 'B']);
- // Exercício 3
var descricao = "Em 1999";- let descricao = "Em 1999";
- descricao += " em São Paulo";
- // Exercício 4
var materia = {titulo: "Barão de Limeira"};- const materia = {titulo: "Barão de Limeira"};
- materia.titulo = "Alameda " + materia.titulo;
- // Exercício 5
for (var i = 10; i--;) {- for (let i = 10; i--;) {
- console.log(i);
- }
- // Exercício 6
for (var tag of ['A', 'B']) {- for (const tag of ['A', 'B']) {
- console.log(tag);
- }
- // Exercício 7
- for (var j = [].length; j--;) {}
- if (j === -1) {
- console.log('Não encontrei');
- }
- // Exercício 8
var a = 123;- let a = 123;
- {
- a *= 2;
- }
- console.log(a);
- // Exercício 9
var state = 'active';- let state = 'active';
- function stop() {
- state = 'paused';
- }
- stop();
- // Exercício 10
var TRUE = !0;- const TRUE = !0;
I wonder what this does?
(defn goes-before? [val1 val2] (<= val1 val2))
;; bubble: list of number -> list of number
;; This was originally racket code,
;; so it used 'car' and 'cdr' instead of 'first' and 'next'
;; Why can't clojure keep my theming?
(defn bubble [tanks]
;; I'm using nested if statements here because I want to use let
(if (or (nil? tanks) (nil? (next tanks)))
(cons tanks '(false))
(let* [truck (first tanks) convoy (next tanks) jeep (first convoy)]
(if (goes-before? truck jeep)
(let [debrief (bubble convoy)] (cons (cons truck (first debrief)) (next debrief)))
(cons (cons jeep (first (bubble (cons truck (next convoy))))) '(true))
)
)
)
)
;; bubble-sort: list of number -> list of number
(defn bubble-sort [l]
(let [bubbly (bubble l)]
(if (first (next bubbly))
(bubble-sort (first bubbly))
(first bubbly)
)))
(prn (bubble-sort (list 5 4 3 2 1)))
def solution(roman): roman_numbers = { 'I': 1, 'II': 2, 'III': 3, 'IV': 4, 'V': 5, 'VI': 6, 'VII': 7, 'VIII': 8, 'IX': 9, 'X': 10, 'XL': 40, 'L': 50, 'XC': 90, 'C': 100, 'CD': 400, 'D': 500, 'CM': 900, 'M': 1000, } n = 0 i = len(roman) while roman: s = roman[: i + 1] d = roman_numbers.get(s) if d: n += d roman = roman[i + 1 :] i = len(roman) else: i -= 1 return n
package kata- def solution(roman):
- roman_numbers = {
- 'I': 1,
- 'II': 2,
- 'III': 3,
- 'IV': 4,
- 'V': 5,
- 'VI': 6,
- 'VII': 7,
- 'VIII': 8,
- 'IX': 9,
- 'X': 10,
- 'XL': 40,
- 'L': 50,
- 'XC': 90,
- 'C': 100,
- 'CD': 400,
- 'D': 500,
- 'CM': 900,
- 'M': 1000,
- }
- n = 0
- i = len(roman)
- while roman:
- s = roman[: i + 1]
- d = roman_numbers.get(s)
- if d:
- n += d
- roman = roman[i + 1 :]
- i = len(roman)
- else:
- i -= 1
- return n
func Decode(roman string) int {return 0}
test.describe("Example Tests") test.assert_equals(solution('XXI'), 21, 'XXI should == 21') test.assert_equals(solution('I'), 1, 'I should == 1') test.assert_equals(solution('IV'), 4, 'IV should == 4') test.assert_equals(solution('MMVIII'), 2008, 'MMVIII should == 2008') test.assert_equals(solution('MDCLXVI'), 1666, 'MDCLXVI should == 1666')
package kata_testimport (. "github.com/onsi/ginkgo". "github.com/onsi/gomega". "codewarrior/kata")var _ = Describe("test roman to decimal converter", func() {It("should give decimal number from roman", func() {Expect(Decode("XXI")).To(Equal(21))})It("should give decimal number from roman", func() {Expect(Decode("I")).To(Equal(1))})It("should give decimal number from roman", func() {Expect(Decode("IV")).To(Equal(4))})It("should give decimal number from roman", func() {Expect(Decode("MMVIII")).To(Equal(2008))})It("should give decimal number from roman", func() {Expect(Decode("MDCLXVI")).To(Equal(1666))})})- test.describe("Example Tests")
- test.assert_equals(solution('XXI'), 21, 'XXI should == 21')
- test.assert_equals(solution('I'), 1, 'I should == 1')
- test.assert_equals(solution('IV'), 4, 'IV should == 4')
- test.assert_equals(solution('MMVIII'), 2008, 'MMVIII should == 2008')
- test.assert_equals(solution('MDCLXVI'), 1666, 'MDCLXVI should == 1666')
const addArr = (arr) => arr?.length ? arr.reduce((sum, num) => sum + num, 0) : null;
function addArr(arr){if(arr.length === 0) return nulllet final = 0arr.forEach(num => {final += num})return final}- const addArr = (arr) => arr?.length ? arr.reduce((sum, num) => sum + num, 0) : null;
const chai = require("chai"); const assert = chai.assert; describe("Solution", function() { it("should test for something", function() { assert.strictEqual(addArr([1, 2, 3, 4, 5]), 15); assert.strictEqual(addArr([1, 100]), 101) assert.strictEqual(addArr([]), null) }); });
- const chai = require("chai");
- const assert = chai.assert;
- describe("Solution", function() {
- it("should test for something", function() {
- assert.strictEqual(addArr([1, 2, 3, 4, 5]), 15);
- assert.strictEqual(addArr([1, 100]), 101)
- assert.strictEqual(addArr([]), null)
- });
- });