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
  • // split out previous solution so I could better understand it
    
    function* powerfulGen(n) {
      let i = 0;
      while (++i<n) {
        let binaryString = i.toString(2); // convert i to binary
        let binaryResult = binaryString.substring(binaryString.lastIndexOf("1")); // Only want from last index of 1, eg 1010 => 10
        yield parseInt(binaryResult, 2); // convert back to base10 and yeild
      }
    }
    
    const powerfulArray = n => [...powerfulGen(2**n)];
    • // split out previous solution so I could better understand it
    • function* powerfulGen(n) {
    • let i = 0;
    • while (++i<n) yield parseInt(i.toString(2).match(/10*$/), 2);
    • while (++i<n) {
    • let binaryString = i.toString(2); // convert i to binary
    • let binaryResult = binaryString.substring(binaryString.lastIndexOf("1")); // Only want from last index of 1, eg 1010 => 10
    • yield parseInt(binaryResult, 2); // convert back to base10 and yeild
    • }
    • }
    • const powerfulArray = n => [...powerfulGen(2**n)];
Fundamentals
Strings
Data Types
Algorithms
Logic
Code
Diff
  • #include <string>
    #include <algorithm>
    bool isPalindrome(const std::string &word) {
      return std::equal(word.cbegin(),word.cbegin() + word.size()/2, word.crbegin());
    }
      
    • #include <string>
    • #include <algorithm>
    • bool isPalindrome(const std::string &word) {
    • return std::string{word.rbegin(),word.rend()}==word;
    • return std::equal(word.cbegin(),word.cbegin() + word.size()/2, word.crbegin());
    • }
Code
Diff
  • Print_Statements = lambda: print('Hello Mark!\nThis is my first python script.\nPython will be fun to learn!\nI am not at COGS, I am at home in my jammies.\nAni Morrow\'s script has ended...have a great semester!')
    • def Print_Statements():
    • print('Hello Mark!
    • This is my first python script.
    • Python will be fun to learn!
    • I am not at COGS, I am at home in my jammies.
    • Ani Morrow\'s script has ended...have a great semester!')
    • Print_Statements = lambda: print('Hello Mark!
    • This is my first python script.
    • Python will be fun to learn!
    • I am not at COGS, I am at home in my jammies.
    • Ani Morrow\'s script has ended...have a great semester!')
Code
Diff
  • const countVowel = s => s.match(/[aeiou]/gi)?.length | 0
      
    • const countVowel = s => (s.match(/[aeiou]/ig) || []).length
    • const countVowel = s => s.match(/[aeiou]/gi)?.length | 0

no need to write values in hexa. now is more readable

Code
Diff
  • isEven = _0x55bac8 => _0x55bac8 % 2 == 0 ;
    • isEven = _0x55bac8 => _0x55bac8 % 0x2 === 0x0 ;
    • isEven = _0x55bac8 => _0x55bac8 % 2 == 0 ;

the default value of a string is always null.
the variables in method are local and they will be not used anyway.

Code
Diff
  • namespace Test {
      public class Test {
        public string a, b;
        
        public bool DummyMethod() 
        {  
          return true;      
        }
        
      }
    }
    • namespace Test {
    • public class Test {
    • public string a, b;
    • public bool DummyMethod()
    • {
    • string local_a = default;
    • return local_a ==null;
    • return true;
    • }
    • }
    • }