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.
using System; using System.Linq; public class Kata { private const int monmeValue = 60; public static int[] PurchaseTofu(int cost, string box) { string[] boxSplited = box.Split(' '); var monCount = boxSplited.Count(x => x == "mon");//one foreach will be faster than this 2 lines but this is easier to read var monmeCount = boxSplited.Count(x => x == "monme"); var totalValue = monCount + (monmeCount * monmeValue); int monmeCounter = Math.Min(cost / monmeValue, monmeCount); cost -= monmeCounter * monmeValue; return (monCount < cost) ? new[] { 0 } : //leaving the market new[] { monCount, monmeCount, totalValue, monmeCounter + cost }; } }
- using System;
- using System.Linq;
- public class Kata
- {
- private const int monmeValue = 60;
- public static int[] PurchaseTofu(int cost, string box)
- {
string[] boxSplited = box.Split(' ');- string[] boxSplited = box.Split(' ');
- var monCount = boxSplited.Count(x => x == "mon");//one foreach will be faster than this 2 lines but this is easier to read
- var monmeCount = boxSplited.Count(x => x == "monme");
var totalValue = monCount + (monmeCount * 60);- var totalValue = monCount + (monmeCount * monmeValue);
int monmeCounter = cost / 60;if (monmeCounter > monmeCount){monmeCounter = monmeCount;}cost -= monmeCounter*60;- int monmeCounter = Math.Min(cost / monmeValue, monmeCount);
- cost -= monmeCounter * monmeValue;
if (monCount < cost){return new[] { 0 };//leaving the market}return new[] { monCount, monmeCount, totalValue, monmeCounter + cost };- return (monCount < cost) ?
- new[] { 0 } : //leaving the market
- new[] { monCount, monmeCount, totalValue, monmeCounter + cost };
- }
- }
#!/bin/bash if [ $# -eq 1 ]; then echo "$1" fi
echo "$1"- #!/bin/bash
- if [ $# -eq 1 ]; then
- echo "$1"
- fi
printTest = run_shell args: ['test'] describe "Solution" do it "should print \"test\"" do expect(printTest).to include('test') end end
- printTest = run_shell args: ['test']
- describe "Solution" do
it "should print 'test'" doarg = 'test\\test'expect(run_shell(args: [arg]).strip).to eq(arg)end- it "should print \"test\"" do
- expect(printTest).to include('test')
- end
- end
Prints "Hello Bash" and any parameters to stdout.
#!/bin/bash echo Hello Bash! if [ $# -eq 1 ]; then echo "Hello, $1!" else echo "No parameters found." fi
echo Hello Bash!- #!/bin/bash
- echo Hello Bash!
- if [ $# -eq 1 ]; then
- echo "Hello, $1!"
- else
- echo "No parameters found."
- fi
# TODO: replace with your own tests (TDD). An example to get you started is included below. # run the solution and store its result output = run_shell args: ['Kumite'] describe "Solution" do it "should return the argument passed in" do expect(output).to include('Hello Bash!') end end
- # TODO: replace with your own tests (TDD). An example to get you started is included below.
- # run the solution and store its result
output = run_shell- output = run_shell args: ['Kumite']
- describe "Solution" do
- it "should return the argument passed in" do
- expect(output).to include('Hello Bash!')
- end
- end
Сan not be stored list in the memory