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.
let results = [ {materia: {conteudo: {titulo: 'São Paulo'}}, tags: [1, 2, 3]}, {materia: {conteudo: {}}, tags: [3, 2]}, {materia: {conteudo: {titulo: 'Rio de Janeiro'}}, tags: [3, 2]}, ]; for (const {materia: {conteudo: {titulo = "Brasil"}}} of results) { console.log(titulo); }
- let results = [
- {materia: {conteudo: {titulo: 'São Paulo'}}, tags: [1, 2, 3]},
- {materia: {conteudo: {}}, tags: [3, 2]},
- {materia: {conteudo: {titulo: 'Rio de Janeiro'}}, tags: [3, 2]},
- ];
for (const result of results) {let titulo = result.materia.conteudo.titulo || 'Brasil';- for (const {materia: {conteudo: {titulo = "Brasil"}}} of results) {
- console.log(titulo);
- }
// 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;
function rgbToHsv(rgb) { let [r, g, b] = rgb; const v = Math.max(r, g, b) / 255; if (v == 0) return Array.of(0, 0, 0); r /= v, g /= v, b /= v; const s = 1 - Math.min(r, g, b) / 255; if (s == 0) return Array.of(0, 0, v * 100); r = 255 - (255 - r) / s; g = 255 - (255 - g) / s; b = 255 - (255 - b) / s; const peak = Math.max(r, g, b); let h = 0; if (r == peak) h = g < b ? 360 - b * 60 / 255 : g * 60 / 255; else if (g == peak) h = r > b ? 120 - r * 60 / 255 : 120 + b * 60 / 255; else h = r > g ? 240 + r * 60 / 255 : 240 - g * 60 / 255; return Array.of(Math.round(h), Math.round(s * 100), Math.round(v * 100)); }
- function rgbToHsv(rgb) {
let r = rgb[0], g = rgb[1], b = rgb[2];- let [r, g, b] = rgb;
- const v = Math.max(r, g, b) / 255;
- if (v == 0) return Array.of(0, 0, 0);
r /= v;g /= v;b /= v;- r /= v, g /= v, b /= v;
- const s = 1 - Math.min(r, g, b) / 255;
- if (s == 0) return Array.of(0, 0, v * 100);
- r = 255 - (255 - r) / s;
- g = 255 - (255 - g) / s;
- b = 255 - (255 - b) / s;
- const peak = Math.max(r, g, b);
- let h = 0;
- if (r == peak) h = g < b ? 360 - b * 60 / 255 : g * 60 / 255;
- else if (g == peak) h = r > b ? 120 - r * 60 / 255 : 120 + b * 60 / 255;
- else h = r > g ? 240 + r * 60 / 255 : 240 - g * 60 / 255;
- return Array.of(Math.round(h), Math.round(s * 100), Math.round(v * 100));
- }
def NotDumbRockPaperScissors(player1, player2): rock = {"paper"} paper = {"scissors"} scissors = {"rock"} # set variable names to lowercase if player1.lower() in eval(player2.lower()): return "Player 1 wins" elif player2.lower() in eval(player1.lower()): return "Player 2 wins" # converted the input args into lowercase for more consistent comparisons else: return "Draw"
def dumbRockPaperScissors(player1, player2):Rock = {"Paper"}Paper = {"Scissors"}Scissors = {"Rock"}if player1 in eval(player2):- def NotDumbRockPaperScissors(player1, player2):
- rock = {"paper"}
- paper = {"scissors"}
- scissors = {"rock"}
- # set variable names to lowercase
- if player1.lower() in eval(player2.lower()):
- return "Player 1 wins"
elif player2 in eval(player1):- elif player2.lower() in eval(player1.lower()):
- return "Player 2 wins"
- # converted the input args into lowercase for more consistent comparisons
- else:
- return "Draw"
import codewars_test as test from solution import NotDumbRockPaperScissors @test.describe("NotDumbRockPaperScissors") def fixed_tests(): @test.it('Basic Test Cases') def basic_test_cases(): test.assert_equals(NotDumbRockPaperScissors('Rock', 'Rock'),'Draw') test.assert_equals(NotDumbRockPaperScissors('Rock', 'Paper'),'Player 2 wins') test.assert_equals(NotDumbRockPaperScissors('Paper', 'Rock'),'Player 1 wins') test.assert_equals(NotDumbRockPaperScissors('Paper', 'Paper'),'Draw') test.assert_equals(NotDumbRockPaperScissors('Rock', 'Scissors'),'Player 1 wins') test.assert_equals(NotDumbRockPaperScissors('Paper', 'Scissors'),'Player 2 wins') test.assert_equals(NotDumbRockPaperScissors('Scissors', 'Rock'),'Player 2 wins') test.assert_equals(NotDumbRockPaperScissors('Scissors', 'Paper'),'Player 1 wins') test.assert_equals(NotDumbRockPaperScissors('Scissors', 'Scissors'),'Draw')
- import codewars_test as test
from solution import dumbRockPaperScissors- from solution import NotDumbRockPaperScissors
@test.describe("dumbRockPaperScissors")- @test.describe("NotDumbRockPaperScissors")
- def fixed_tests():
- @test.it('Basic Test Cases')
- def basic_test_cases():
test.assert_equals(dumbRockPaperScissors('Rock', 'Rock'),'Draw')test.assert_equals(dumbRockPaperScissors('Rock', 'Paper'),'Player 2 wins')test.assert_equals(dumbRockPaperScissors('Paper', 'Rock'),'Player 1 wins')test.assert_equals(dumbRockPaperScissors('Paper', 'Paper'),'Draw')test.assert_equals(dumbRockPaperScissors('Rock', 'Scissors'),'Player 1 wins')test.assert_equals(dumbRockPaperScissors('Paper', 'Scissors'),'Player 2 wins')test.assert_equals(dumbRockPaperScissors('Scissors', 'Rock'),'Player 2 wins')test.assert_equals(dumbRockPaperScissors('Scissors', 'Paper'),'Player 1 wins')test.assert_equals(dumbRockPaperScissors('Scissors', 'Scissors'),'Draw')- test.assert_equals(NotDumbRockPaperScissors('Rock', 'Rock'),'Draw')
- test.assert_equals(NotDumbRockPaperScissors('Rock', 'Paper'),'Player 2 wins')
- test.assert_equals(NotDumbRockPaperScissors('Paper', 'Rock'),'Player 1 wins')
- test.assert_equals(NotDumbRockPaperScissors('Paper', 'Paper'),'Draw')
- test.assert_equals(NotDumbRockPaperScissors('Rock', 'Scissors'),'Player 1 wins')
- test.assert_equals(NotDumbRockPaperScissors('Paper', 'Scissors'),'Player 2 wins')
- test.assert_equals(NotDumbRockPaperScissors('Scissors', 'Rock'),'Player 2 wins')
- test.assert_equals(NotDumbRockPaperScissors('Scissors', 'Paper'),'Player 1 wins')
- test.assert_equals(NotDumbRockPaperScissors('Scissors', 'Scissors'),'Draw')