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.

This is what I have for ROT13.

Make it better without using codecs and one line at the same time!

def rot13(s):
    return rot.encode(s,"rot_13")
Code
Diff
  • import java.util.stream.Stream;
    
    public class AbbreviateTwoWords {
      public static String abbrevName(String name) {
            return Stream.of(name.split(" "))
                    .map(it -> it.substring(0, 1).toUpperCase())
                    .reduce((l, r) -> l + "." + r)
                    .get();
        }
    }
  • 1-public class AbbreviateTwoWords {
    1+import java.util.stream.Stream;
    22
    3+public class AbbreviateTwoWords {
    33 public static String abbrevName(String name) {
    4- String[] names = name.split(" ");
    5- return (names[0].charAt(0) + "." + names[1].charAt(0)).toUpperCase();
    6- }
    5+ return Stream.of(name.split(" "))
    6+ .map(it -> it.substring(0, 1).toUpperCase())
    7+ .reduce((l, r) -> l + "." + r)
    8+ .get();
    9+ }
    77 }
Code
Diff
  • public class FirstClass {
        public static byte sum (byte a, byte b) {
            return (byte)(a + b);
        }
    }
  • 11 public class FirstClass {
    22 public static byte sum (byte a, byte b) {
    3- byte c = (byte) (a + b);
    4- return c;
    3+ return (byte)(a + b);
    55 }
    66 }
import java.util.stream.*; public class Kata { public static int findShort(String s) { return Stream.of(s.split(" ")) .mapToInt(String::length) .min() .getAsInt(); } }
add(A, B, R) :- R is A + B.
ES2015
Babel

'Cuase why not :)

Code
Diff
  • /**
     * @param {Number} approximation - number of decimal places you're loojing for. 
     *  Shouldn't exceed 6 as Zu Chongzhi ratio are only valid until first 6 digits.
     *  Is 2 by default.
     */
    const pi = (approximation = 2) =>
      /** Let's use [this guy's](https://en.wikipedia.org/wiki/Zu_Chongzhi) ratio to calc Pi */
      (355 / 113).toFixed(approximation > 2 && approximation <= 6 ? approximation : 2)
  • 1-const pi = () => {
    2-
    3-}
    4-
    5-pi()
    1+/**
    2+ * @param {Number} approximation - number of decimal places you're loojing for.
    3+ * Shouldn't exceed 6 as Zu Chongzhi ratio are only valid until first 6 digits.
    4+ * Is 2 by default.
    5+ */
    6+const pi = (approximation = 2) =>
    7+ /** Let's use [this guy's](https://en.wikipedia.org/wiki/Zu_Chongzhi) ratio to calc Pi */
    8+ (355 / 113).toFixed(approximation > 2 && approximation <= 6 ? approximation : 2)
describe("Solution", function() {
  it("should test for something", function() {
   
  });
});
Code
Diff
  • rating = lambda n=0: {1:'Terrible', 2:'Bad', 3:'Okay', 4:'Good', 5:'Excellent'}.get((0, n)[type(n) == int], 'Enter a rating from 1 to 5')
  • 1-rating = lambda r: dict(enumerate(['Terrible', 'Bad', 'Okay', 'Good', 'Excellent'])).get(r - 1, "Enter a rating from 1 to 5")
    1+rating = lambda n=0: {1:'Terrible', 2:'Bad', 3:'Okay', 4:'Good', 5:'Excellent'}.get((0, n)[type(n) == int], 'Enter a rating from 1 to 5')