The story is nice !
But you have some problems with this kata.
First, you have some crew dict that contains floats. Considering you explicitly talk about "flat amount" for the captain's tax and the total of spoils, it is not really logical to have floats there.
Second, you have floating point error in your calculations ! I first tried to calculate fair with a different formula than the one you used and I could not pass some random tests. But it was good as soon as I rewrite the formula. So I really think you should rewrite some things.
For example: "the length of each word does not exceed the amount of words in the string" to "the length of each word does not exceed the total number of words in the string"
Consider adding counts: "If complex: return "Keep It Simple Stupid"" --> total number of words: 4; length of "Simple" and "Stupid" is 6, so are longer than the number of words
In the description you should emplicitly mention that each variable is one small case letter.
Maybe one addition on fix 3 characters is too simple.. What about extending the possible inputs e.g. with spaces and/or more additions, perhaps other operations?
Lua translation!
python new test framework is required. updated in this fork
Java translation (Kumited from the 7 year old one)
But now it's an actual percentage, such as
.05
.Floating point errors in random tests.
Python fork
Java translation available, please check and approve. Thanks!
This comment is hidden because it contains spoiler information about the solution
Hi,
The story is nice !
But you have some problems with this kata.
fair
with a different formula than the one you used and I could not pass some random tests. But it was good as soon as I rewrite the formula. So I really think you should rewrite some things.For now, the trouble is that :
The left version works. the right does not.
Please consider making the description more clear
For example: "the length of each word does not exceed the amount of words in the string" to "the length of each word does not exceed the total number of words in the string"
Consider adding counts: "If complex: return "Keep It Simple Stupid"" --> total number of words: 4; length of "Simple" and "Stupid" is 6, so are longer than the number of words
Thanks!
In the description you should emplicitly mention that each variable is one small case letter.
Maybe one addition on fix 3 characters is too simple.. What about extending the possible inputs e.g. with spaces and/or more additions, perhaps other operations?