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.
export const checkIfAtOrBelowLimit = (driverSpeeds: number[], speedLimit: number): number[] => { return driverSpeeds.map(speed => CalculateFine(speed, speedLimit)); } const CalculateFine = (speed: number, limit: number) => { if(speed > limit + 30) return 500 if (speed > limit + 20 && speed < limit + 29) return 250 if (speed > limit + 10 && speed < limit + 19) return 100 return 0 }
- export const checkIfAtOrBelowLimit = (driverSpeeds: number[], speedLimit: number): number[] => {
- return driverSpeeds.map(speed => CalculateFine(speed, speedLimit));
- }
- const CalculateFine = (speed: number, limit: number) => {
if(speed > limit + 30) {return 500;} else if (speed > limit + 20 && speed < limit + 29) {return 250;} else if (speed > limit + 10 && speed < limit + 19) {return 100;} else {return 0;}- if(speed > limit + 30) return 500
- if (speed > limit + 20 && speed < limit + 29) return 250
- if (speed > limit + 10 && speed < limit + 19) return 100
- return 0
- }
function ShowDate() { const days = {'1':'st','2':'nd','3':'rd'}; const date = new Date().toLocaleDateString('en', {month: 'long', day: 'numeric', year: 'numeric'}) const dateFixed = date.replace(',', days[new Date().getDate()]?? 'th') return dateFixed }
- function ShowDate() {
const months = {'Jan':'January','Feb':'February','Mar':'March','Apr':'April','May':'May','Jun':'June','Jul':'July','Aug':'Augest','Sep':'September','Oct':'October','Nov':'November','Dec':'December'};- const days = {'1':'st','2':'nd','3':'rd'};
return new Date().toDateString().slice(4).split(' ').map((e,i) => i?i==1?+e+(days[e.slice(-1)]||'th'):e:months[e]).join(' ');- const date = new Date().toLocaleDateString('en', {month: 'long', day: 'numeric', year: 'numeric'})
- const dateFixed = date.replace(',', days[new Date().getDate()]?? 'th')
- return dateFixed
- }
i fixed it
use std::arch::asm; #[cfg(target_arch = "x86_64")] pub fn multiply(a: usize, b: usize) -> usize { let mut result: usize; unsafe { asm!( "mov {result}, 0", "2:", "add {result}, {a}", "dec {b}", // i mean like no ones gonna notice if we modify it :3 "cmp {b}, 0", "ja 2b", a = in(reg) a, b = in(reg) b, result = out(reg) result, ); } result }
fn multiply(a: usize, b: usize) -> usize {a * b- use std::arch::asm;
- #[cfg(target_arch = "x86_64")]
- pub fn multiply(a: usize, b: usize) -> usize {
- let mut result: usize;
- unsafe {
- asm!(
- "mov {result}, 0",
- "2:",
- "add {result}, {a}",
- "dec {b}", // i mean like no ones gonna notice if we modify it :3
- "cmp {b}, 0",
- "ja 2b",
- a = in(reg) a,
- b = in(reg) b,
- result = out(reg) result,
- );
- }
- result
- }
#include <stdio.h> prnt_mltply(m,n){for(int i=1;i<=m;i++)for(int j=1;j<=n;j++)printf("%d * %d = %d\n",i,j,i*j);return m*n;}
- #include <stdio.h>
int prnt_mltply(int m, int n) {for (int i = 0; i < m; i++) for (int j = 1; j <= n; j++) printf("%d * %d = %d", i + 1, j, (i+1) * j);return m * n;}- prnt_mltply(m,n){for(int i=1;i<=m;i++)for(int j=1;j<=n;j++)printf("%d * %d = %d
- ",i,j,i*j);return m*n;}
#include <iostream> #include <string> using namespace std; bool helloWorld() { return [](const string &H, const string &W){ return (cout << H << W << endl).good(); }("Hello, ", "World!"); }
//Created by RHB// Your code here- #include <iostream>
- #include <string>
- using namespace std;
int main() {string H, W;H="Hello ";W="World!";cout << H << W << endl;return 0;- bool helloWorld() {
- return [](const string &H, const string &W){
- return (cout << H << W << endl).good();
- }("Hello, ", "World!");
- }
// TODO: Replace examples and use TDD by writing your own tests Describe(any_group_name_you_want) { It(should_do_something) { Assert::That(helloWorld(), Equals(true)); } };
- // TODO: Replace examples and use TDD by writing your own tests
- Describe(any_group_name_you_want)
- {
- It(should_do_something)
- {
- Assert::That(helloWorld(), Equals(true));
- }
- };
firstNonRepeatingCharacter=s=>(j=s.split``,r=j.reduce((o,c)=>(o[c]=(o[c]??0)+1,o),{}),j.find(c=>r[c]==1)??null)
const firstNonRepeatingCharacter = (str) => {let counts = {};for(const char of str) {counts[char] = 1 + (counts[char] ? counts[char] : 0);}for(const char in counts) {if(counts[char] == 1) {return char;}}return null;}- firstNonRepeatingCharacter=s=>(j=s.split``,r=j.reduce((o,c)=>(o[c]=(o[c]??0)+1,o),{}),j.find(c=>r[c]==1)??null)
Leading characters that are not letters should be ignored.
Added relevant test cases.
module ToUpperFirst where import Data.Char (toUpper, isLetter) toUpperFirst :: String -> String toUpperFirst str = case break isLetter str of (xs, y:ys) -> xs ++ toUpper y : ys _ -> str
- module ToUpperFirst where
import Data.Char (toUpper, isSpace)toUpperFirst (x : xs) = if isSpace x then x : toUpperFirst xs else toUpper x : xstoUpperFirst _ = ""- import Data.Char (toUpper, isLetter)
- toUpperFirst :: String -> String
- toUpperFirst str =
- case break isLetter str of
- (xs, y:ys) -> xs ++ toUpper y : ys
- _ -> str
module ExampleSpec where import Test.Hspec import ToUpperFirst spec :: Spec spec = do describe "toUpperFirst" $ do it "should capitalize first letter of a string" $ do toUpperFirst "" `shouldBe` "" toUpperFirst "finn the human" `shouldBe` "Finn the human" toUpperFirst "alice" `shouldBe` "Alice" toUpperFirst "Joe" `shouldBe` "Joe" toUpperFirst " bob" `shouldBe` " Bob" toUpperFirst "\nsteven" `shouldBe` "\nSteven" it "should work if the first letter occurs after digits" $ do toUpperFirst "3fish" `shouldBe` "3Fish" toUpperFirst "383\n 38boB" `shouldBe` "383\n 38BoB"
- module ExampleSpec where
- --- Tests can be written using Hspec http://hspec.github.io/
- --- Replace this with your own tests.
- import Test.Hspec
- import ToUpperFirst
- --- `spec` of type `Spec` must exist
- spec :: Spec
- spec = do
describe "toUpperFirst" $ doit "should capitalize first letter of a string" $ dotoUpperFirst "" `shouldBe` ""toUpperFirst "finn the human" `shouldBe` "Finn the human"toUpperFirst "alice" `shouldBe` "Alice"toUpperFirst "Joe" `shouldBe` "Joe"toUpperFirst " bob" `shouldBe` " Bob"toUpperFirst "steven" `shouldBe` "Steven"-- the following line is optional for 8.2main = hspec spec- describe "toUpperFirst" $ do
- it "should capitalize first letter of a string" $ do
- toUpperFirst "" `shouldBe` ""
- toUpperFirst "finn the human" `shouldBe` "Finn the human"
- toUpperFirst "alice" `shouldBe` "Alice"
- toUpperFirst "Joe" `shouldBe` "Joe"
- toUpperFirst " bob" `shouldBe` " Bob"
- toUpperFirst "
- steven" `shouldBe` "
- Steven"
- it "should work if the first letter occurs after digits" $ do
- toUpperFirst "3fish" `shouldBe` "3Fish"
- toUpperFirst "383\n 38boB" `shouldBe` "383\n 38BoB"