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
  • converter = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"].__getitem__
    • converter = lambda n: ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"][n]
    • converter = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"].__getitem__
Code
Diff
  • namespace Test {
      public class Test {
        public string a, b;
        
        public bool DummyMethod() 
        {  
          string local_b, local_a = default;
          local_b = null;     
          return local_a == local_b;      
        }
        
      }
    }
    • namespace Test {
    • public class Test {
    • public string a,b = null;
    • public string a, b;
    • public bool DummyMethod() {
    • public bool DummyMethod()
    • {
    • string local_b, local_a = default;
    • local_b = null;
    • return local_a == local_b;
    • }
    • }
    • }

the string values are not used in code.

Code
Diff
  • using System.Collections.Generic;
    using System.Diagnostics;
    
    public class TowerOfHanoi
    {
        public static int Tower(int numOfDisks)
        {
          //only numOfDisks is given, fill in the other gaps, call the other method that moves disks, and return the return statement from the other method
          return Tower(numOfDisks, new Dictionary<int, int>());
        }
    
        private static int Tower(int n, Dictionary<int, int> cache)
        {
          //dictionary has keys and values.
           if (n > 0) // if one or more disks
            {
              if (cache.ContainsKey(n)) //check if dictionary contains an element with the specified key
              {
                  return cache[n]; 
              }
              //variable declared at method scope
              //outcome will be the number of moves in test
              var outcome = Tower(n - 1, cache); //move disk from rod to rod using recursion
              outcome += Tower(n - 1, cache); 
              outcome += 1;
              cache.Add(n, outcome); 
              return outcome; 
            }
            else { //if no disks given, no moves possible
              return 0;
            }
        }
    }
    
    //mathematical way to calculate moves
    //using System;
    //static int moves = 0;
    //method body
    // return moves = (int) Math.Pow(2,numOfDisks)-1;
    • using System.Collections.Generic;
    • using System.Diagnostics;
    • public class TowerOfHanoi
    • {
    • public static int Tower(int numOfDisks)
    • {
    • //only numOfDisks is given, fill in the other gaps, call the other method that moves disks, and return the return statement from the other method
    • return Tower(numOfDisks, "source", "aux", "dest", new Dictionary<int, int>());
    • return Tower(numOfDisks, new Dictionary<int, int>());
    • }
    • private static int Tower(int n, string source, string aux, string dest, Dictionary<int, int> cache)
    • private static int Tower(int n, Dictionary<int, int> cache)
    • {
    • //dictionary has keys and values.
    • if (n > 0) // if one or more disks
    • {
    • if (cache.ContainsKey(n)) //check if dictionary contains an element with the specified key
    • {
    • return cache[n];
    • }
    • //variable declared at method scope
    • //outcome will be the number of moves in test
    • var outcome = Tower(n - 1, source, aux, dest, cache); //move disk from rod to rod using recursion
    • outcome += Tower(n - 1, aux, dest, source, cache);
    • var outcome = Tower(n - 1, cache); //move disk from rod to rod using recursion
    • outcome += Tower(n - 1, cache);
    • outcome += 1;
    • cache.Add(n, outcome);
    • return outcome;
    • }
    • else { //if no disks given, no moves possible
    • return 0;
    • }
    • }
    • }
    • //mathematical way to calculate moves
    • //using System;
    • //static int moves = 0;
    • //method body
    • // return moves = (int) Math.Pow(2,numOfDisks)-1;
Code
Diff
  • lambda x: None
    
    
    • encoded_str = '111`021`121`901`23`411`79`101`001`44`23`111`801`801`101`401'
    • decode = lambda x: ''.join(map(chr,map(int,x[::-1].split('`'))))
    • print(decode(encoded_str))
    • lambda x: None
Mathematics
Algorithms
Logic
Numbers
Data Types

Hmmm yes useless wrapper functions

Code
Diff
  • using System;
    using System.Linq;
    
    public class Sum
    {
       public Int64 GetSum(params Int64[] nums) => nums.Sum();
    }
    • using System;
    • using System.Linq;
    • public class Sum
    • {
    • public Int64 GetSum(Int64 a, Int64 b) => a + b;
    • public Int64 GetSum(params Int64[] nums) => nums.Sum();
    • }
Code
Diff
  • isEven=_0x55bac8=>_0x55bac8%0x2===0x0;
    • isEven=ॱ=>_(ॱ)
    • isEven=_0x55bac8=>_0x55bac8%0x2===0x0;
Code
Diff
  • Palindrome=ॱ=>(ॱ=>ॱ==[...ॱ].reverse().join``)(ॱ.toUpperCase())
    • function Palindrome(str){
    • // Case insensitive palindrome
    • for (let i = 0, j = str.length - 1; i < j; i++, j--) {
    • if (str[i].toLowerCase() !== str[j].toLowerCase()) return false;
    • }
    • return true;
    • }
    • Palindrome=ॱ=>(ॱ=>ॱ==[...ॱ].reverse().join``)(ॱ.toUpperCase())
Code
Diff
  • //countVowelAtWord=s=>s.replace(!/[aeiou]/ig,``).length
    
    const countVowel=s=>s.replace(/[aeiou ]/ig,'').length
      
    • countVowelAtWord=s=>s.replace(!/[aeiou]/ig,``).length
    • //countVowelAtWord=s=>s.replace(!/[aeiou]/ig,``).length
    • const countVowel=s=>s.replace(/[aeiou ]/ig,'').length