Begin a new Kumite
Search
About
  • Filter by Language:
  • 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.

Code
Diff
  • o=lambda n: n if n%2==1 else n-1
  • 1
    def o(n): return n-(n%2==0)
    
    1+
    o=lambda n: n if n%2==1 else n-1
    

Recent Moves:

Code
Diff
  • e=lambda n:n if n%2 == 0 else n-1
  • 1
    e=lambda n:n&-2
    
    1+
    e=lambda n:n if n%2 == 0 else n-1
    

Recent Moves:

Code
Diff
  • using System;
    
    class Kata
    {
      private static string LANGUAGE = "C#";
      
      public static void Main()
      {
        string[] hello = {"H","e","l","l","o"};
        
        Array.ForEach(hello, s => Console.Write(s));
        
        Console.WriteLine(", " + LANGUAGE + "!" );
        
      }
      
      
    }
  • 11
    using System;
    
    22
    33
    class Kata
    
    44
    {
    
    55
      private static string LANGUAGE = "C#";
    
    66
      
    
    77
      public static void Main()
    
    88
      {
    
    99
        string[] hello = {"H","e","l","l","o"};
    
    10
        string result = "";
    
    1111
        
    
    12
        foreach(string s in hello){
    
    13
          result = result + s;
    
    14
        }
    
    11+
        Array.ForEach(hello, s => Console.Write(s));
    
    1515
        
    
    16
        Console.WriteLine(result + ", " + LANGUAGE + "!" );
    
    13+
        Console.WriteLine(", " + LANGUAGE + "!" );
    
    1717
        
    
    1818
      }
    
    1919
      
    
    2020
      
    
    2121
    }
    

Recent Moves:

You need to resolve the famous game of Big Bang Theory.

for resume :

Scissors cut paper and decapited lizard.

Paper disproves Spock and covers rocks.

Lizard poison Spock and eats paper.

Spock smashes scissors and vaporizes rock.

rock crushes scissors and crushes lizard.

and return draw if draw.


I'm a student please be kind to my mistakes :)

string rps(const std::string p1, const std::string p2)
{
 
 std::map<std::string, int> dict;

 dict["rock"] = 0;
 dict["paper"] = 1;
 dict["scissors"] = 2;
 dict["lizard"] = 3;
 dict["spock"] = 4;

 if(p1 == p2) return "Draw!";

 if(dict[p1] == 0){

 if(dict[p2] == 1) return "Player 2 won!";
 if(dict[p2] == 2) return "Player 1 won!";
 if(dict[p2] == 3) return "Player 1 won!";
 if(dict[p2] == 4) return "Player 2 won!";

 }
 if(dict[p1] == 1){
 if(dict[p2] == 0) return "Player 1 won!";
 if(dict[p2] == 2) return "Player 2 won!";
 if(dict[p2] == 3) return "Player 2 won!";
 if(dict[p2] == 4) return "Player 1 won!";
 }
 if(dict[p1] == 2){
 if(dict[p2] == 0) return "Player 2 won!";
 if(dict[p2] == 1) return "Player 1 won!";
 if(dict[p2] == 3) return "Player 1 won!";
 if(dict[p2] == 4) return "Player 2 won!";
 }
 if(dict[p1] == 3){
 if(dict[p2] == 0) return "Player 2 won!";
 if(dict[p2] == 1) return "Player 1 won!";
 if(dict[p2] == 2) return "Player 2 won!";
 if(dict[p2] == 4) return "Player 1 won!";
 }
 if(dict[p1] == 4){
 if(dict[p2] == 0) return "Player 1 won!";
 if(dict[p2] == 1) return "Player 2 won!";
 if(dict[p2] == 2) return "Player 1 won!";
 if(dict[p2] == 3) return "Player 2 won!";
 }
}
{
    It(should_pass_some_example_tests)
    {
        Assert::That(rps("rock", "lizard"), Equals("Player 1 won!"));
        Assert::That(rps("rock", "paper"), Equals("Player 2 won!"));
        Assert::That(rps("spock", "spock"), Equals("Draw!"));
    }
}

no need for len()

Code
Diff
  • from math import prod
    
    def prod_(arr):
        return prod(arr) if arr else 2 + 2 == 5
  • 11
    from math import prod
    
    2
    def prod_(l):
    
    3
        return prod(l) if len(l)>0 else 0
    
    2+
    3+
    def prod_(arr):
    
    4+
        return prod(arr) if arr else 2 + 2 == 5
    

Recent Moves: