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
  • class KumiteFoo:
        def __init__(self, p):
            self.condition = ('No', 'Yes')[len(p) and not sum(map(ord, p.lower())) % 324]
    
        def solution(self):
            return self.condition
    • class KumiteFoo:
    • def __init__(self, p):
    • self.p = p
    • self.condition = ['No', 'Yes'][len(self.p) and not sum(map(ord, self.p.lower())) % 324]
    • self.condition = ('No', 'Yes')[len(p) and not sum(map(ord, p.lower())) % 324]
    • def solution(self):
    • return self.condition
Code
Diff
  • class TemperatureConverter:
        def __init__(self, temp: float) -> None:
            self.temp = temp
            self._celsius_to_fahrenheit_factor = 9/5
            self._celsius_to_fahrenheit_offset = 32
            
        def fahrenheit_to_celsius(self) -> float:
            celsius = (self.temp - 32) * (5/9)
            return round(celsius, 2)
        
        def celsius_to_fahrenheit(self) -> float:
            fahrenheit = (self.temp * self._celsius_to_fahrenheit_factor) + self._celsius_to_fahrenheit_offset
            return round(fahrenheit, 2)
    
    • class TemperatureConverter:
    • def __init__(self, temp):
    • def __init__(self, temp: float) -> None:
    • self.temp = temp
    • self._k1 = 5 / 9
    • self._k2 = self._k1 * 32
    • self._celsius_to_fahrenheit_factor = 9/5
    • self._celsius_to_fahrenheit_offset = 32
    • def fahrenheit_to_celsius(self):
    • return round(self.temp * self._k1 - self._k2, 2)
    • def fahrenheit_to_celsius(self) -> float:
    • celsius = (self.temp - 32) * (5/9)
    • return round(celsius, 2)
    • def celsius_to_fahrenheit(self):
    • return round((self.temp + self._k2) / self._k1, 2)
    • def celsius_to_fahrenheit(self) -> float:
    • fahrenheit = (self.temp * self._celsius_to_fahrenheit_factor) + self._celsius_to_fahrenheit_offset
    • return round(fahrenheit, 2)
Code
Diff
  • import java.util.ArrayList;
    
    public class HowManySongYouCanPlay {
    
    	static int optimo = 0;
        public static int playSongs(int[] songs, int remanente, int contador, int maxTime) {
            if (contador == songs.length || optimo == maxTime) {
                optimo =maxTime-remanente;
            } else {
                if (remanente >= songs[contador]) {
                    playSongs(songs, remanente - songs[contador],
                            contador + 1, maxTime);
                } else {
                    playSongs(songs, remanente, contador + 1, maxTime);
                }
            }
            return optimo;
        }
    }
    • import java.util.ArrayList;
    • public class HowManySongYouCanPlay {
    • public static int playSongs(Integer[] songDuration, ArrayList<Integer> songList, ArrayList<Integer> songTestedList,
    • boolean status) {
    • int maxTime = 60;
    • if (status) {
    • int optimalDuration = sumDuration(songList);
    • int currentDuration = sumDuration(songTestedList);
    • if (currentDuration > optimalDuration) {
    • ArrayList<Integer> aux = songTestedList;
    • songList.clear();
    • for (Integer element : aux) {
    • if (element != null) {
    • songList.add(element);
    • }
    • }
    • }
    • } else {
    • for (int i = 0; i < songDuration.length; i++) {
    • if (!songTestedList.contains(songDuration[i])) {
    • if (maxTime > sumDuration(songTestedList) + songDuration[i]) {
    • songTestedList.add(songDuration[i]);
    • playSongs(songDuration, songList, songTestedList, false);
    • songTestedList.remove(songDuration[i]);
    • } else {
    • playSongs(songDuration, songList, songTestedList, true);
    • }
    • }
    • }
    • }
    • return sumDuration(songList);
    • }
    • public static int sumDuration(ArrayList<Integer> list){
    • int sum = 0;
    • for (int i = 0; i < list.size(); i++) {
    • if (i == list.size()-1){
    • sum += list.get(i);
    • static int optimo = 0;
    • public static int playSongs(int[] songs, int remanente, int contador, int maxTime) {
    • if (contador == songs.length || optimo == maxTime) {
    • optimo =maxTime-remanente;
    • } else {
    • if (remanente >= songs[contador]) {
    • playSongs(songs, remanente - songs[contador],
    • contador + 1, maxTime);
    • } else {
    • sum += list.get(i)+60;
    • playSongs(songs, remanente, contador + 1, maxTime);
    • }
    • }
    • return sum;
    • return optimo;
    • }
    • }
Strings
Arrays
Puzzles
Mathematics