I've made an attempt at generating random valid inputs. Loops aren't generated due to the complexity of ensuring that they don't loop forever. However, they should serve the purpose of weeding out any hard-coded solutions.
make a version of Poohbear that has infinite memory cells in both directions
This requirement is impossible to test. My C solution was able to pass with a fixed 30,000 cells buffer. IMO, this requirement should be removed from the description, or at least marked as a "nice to have".
( They're not vulnerable to input modification, they just don't bite your head off if you do. If brute force should be unallowed ( see below ), I think input modification should be unallowed. )
The point is that it should work with any precision (although I cannot test for any precision because the time would run out).
Nope, there are many ways to calculate pi, some are fast, some are slow
eg. http://numbers.computation.free.fr/Constants/TinyPrograms/tinycodes.html
Your solution is just too slow.
Also, your solution cannot work with any precision because it returns a float, which cannot represent too many digits.
Duplicate of this
Haskell translation
I've made an attempt at generating random valid inputs. Loops aren't generated due to the complexity of ensuring that they don't loop forever. However, they should serve the purpose of weeding out any hard-coded solutions.
python new test framework + random tests are required. updated in this fork
Could be excellent, but.. returning a const char* is bad c++ practice :-(
This comment is hidden because it contains spoiler information about the solution
tests are not very torough in JavaScript either, I had to add a fixed test to invalidate my solution. It needs more test cases like
[857, 85]
c++ version should use std::string instead of const char*
This requirement is impossible to test. My C solution was able to pass with a fixed 30,000 cells buffer. IMO, this requirement should be removed from the description, or at least marked as a "nice to have".
A quote from Kata Authoring Guidelines:
This comment is hidden because it contains spoiler information about the solution
The test difficulty is not consistent across all languages: some languages permit brute-force solutions while others only permit the intended ones.
From PEP 8:
AlphaNum_NumAlpha
does not fit into any prevailing naming style. Please change this toalpha_num_num_alpha
or similar.( JS )
Test don't check against input modification.
( They're not vulnerable to input modification, they just don't bite your head off if you do. If brute force should be unallowed ( see below ), I think input modification should be unallowed. )
Nope, there are many ways to calculate pi, some are fast, some are slow
eg. http://numbers.computation.free.fr/Constants/TinyPrograms/tinycodes.html
Your solution is just too slow.
Also, your solution cannot
work with any precision
because it returns afloat
, which cannot represent too many digits.Needs Random Tests.
Nope. It is YOU, the kata author, who are responsible for restricting solutions that should not be passed (according to the desc).
Loading more items...