Start a new Kumite
AllAgda (Beta)BF (Beta)CCFML (Beta)ClojureCOBOL (Beta)CoffeeScriptCommonLisp (Beta)CoqC++CrystalC#D (Beta)DartElixirElm (Beta)Erlang (Beta)Factor (Beta)Forth (Beta)Fortran (Beta)F#GoGroovyHaskellHaxe (Beta)Idris (Beta)JavaJavaScriptJulia (Beta)Kotlinλ Calculus (Beta)LeanLuaNASMNim (Beta)Objective-C (Beta)OCaml (Beta)Pascal (Beta)Perl (Beta)PHPPowerShell (Beta)Prolog (Beta)PureScript (Beta)PythonR (Beta)RacketRaku (Beta)Reason (Beta)RISC-V (Beta)RubyRustScalaShellSolidity (Beta)SQLSwiftTypeScriptVB (Beta)
Show only mine

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.

Ad
Ad
Code
Diff
  • {
      function todo() {
          return 'Walk';
        }
      
        // reescrever em ES6
        {
      
          function todo() {
            return 'Run';
          }
      
        }
    }
    
    • function todo() {
    • return 'Walk';
    • }
    • // reescrever em ES6
    • (function() {
    • {
    • function todo() {
    • return 'Run';
    • }
    • })();
    • return 'Walk';
    • }
    • // reescrever em ES6
    • {
    • function todo() {
    • return 'Run';
    • }
    • }
    • }
Code
Diff
  • // reescreva usando ES6
    
    var prop = 'myProp';
    
    var obj = {
      [prop]: 123,
      myFunc() {
        return this[prop];
      } 
    };
    
    • // reescreva usando ES6
    • var prop = 'myProp';
    • var obj = {
    • myFunc: function() {
    • [prop]: 123,
    • myFunc() {
    • return this[prop];
    • }
    • };
    • obj[prop] = 123;
Code
Diff
  • 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);
    • }
Code
Diff
  • var bg = 'gray';
    
    var css = `<style>
        body {
          background: ${bg}
          color: black;
        }
      </style>`;
      
    
    • var bg = 'gray';
    • var css = '' +
    • '<style>' +
    • 'body {' +
    • ' background: '+ bg + ';' +
    • ' color: black;'
    • '}' +
    • '</style>';
    • var css = `<style>
    • body {
    • background: ${bg}
    • color: black;
    • }
    • </style>`;
Code
Diff
  • // 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;

"Hello Python!" script.

print "Hello Python!"
Code
Diff
  • 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));
    • }
Sets
Code
Diff
  • 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"