Ad
  • Default User Avatar

    The failed test cases just say that I need to implement the count and depth methods recursively.. does that mean that I didn't implement them recursively, or does it mean something else?

  • Default User Avatar

    Thanks for all your responses and the new feature. I have posted my non-working solution as a question on that kata, if you are curious. But I'm already cringing at the impending humiliation, haha.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    In response to your first paragraph: You are erroneously equating the solvability of a kata with it deserving to be on codewars. Using that logic, almost any kata, no matter how bad, deserves to be on the site. If I create a kata that says "guess the correct code" in which the answer is a fixed alphanumeric string chosen by me, it is solvable, but that does not mean it should be on the site. Coding is about translating human thought/language into computer language. A user could be a coding savant but without understanding what the kata writer wants, there is no way he/she can complete the kata. The only way to achieve an understanding of what is required from the kata is through reading the specs and the tests. So if the specs and the tests are deficient, that is a problem with the kata.

    Likewise, in the previous example I gave you, the binary tree class that I wrote does everything that the specs ask it to do and then some. That is why it passes all the tests except for two that are attempting to detect the usage of recursion. It also should pass the test that it is failing. The problem is that the test is not checking for what it says it's checking for. If the test says that I'm not writing a recursive function, but I am in fact writing a recursive function, then either the test is wrong or I don't know what recursion is. I'm guessing you're assuming the latter.

    The fact that the kata has been solved by 287 people proves that the kata is solvable. But as I said earlier, the solvability of a kata is not as important as the degree to which that solvability is a test of coding ability or computer science knowledge versus being lucky enough to guess the kind of code that responds well to the tests.

    I could reduce this issue even further - let's say I write a kata that simply states "write a recursive function." When writing my tests, do I have an obligation to ensure that all recursive functions pass the tests? Or would it be okay that only some recursive functions pass the tests? The latter standard, in addition to being a terrible user experience, simply does not exist in the real world, because in the real world, no matter how obscure and arcane a bug might be, you can always trace it to something that makes theoretical sense. If your code is flawless you can trace the problem to the framework, and then to the framework's dependencies, and if that doesn't work, you can look at how the language itself works, and if that doesn't work you can trace it all the way down to the laws of physics that govern the hardware on which the software is running. But at some point, eventually, you are guaranteed to hit something that makes sense, always. Not so on code wars, because you cannot view the source code for the arbitrary tests written at the discretion of an imperfect human being.

    Anyway thanks for pushing the update. At least now I can avoid kata with lots of open issues.

  • Default User Avatar

    Let me give you an example. The one and only kata I have not been able to complete in code wars is one that you, jhoffner, have contributed to: http://www.codewars.com/kata/functional-binary-trees

    I have an issue open on that kata for the past 5 days with no response. Since it is not in beta, there is no incentive to address my issue. If I were a moderator I would close the kata to the public until the issue is resolved.

  • Default User Avatar

    I am not talking about kata that are still in the beta process. I'm pointing out that there is currently no incentive for anyone to fix kata that have already been approved. I'm not saying developers should be barred from writing buggy code. I'm saying they should be barred from writing new kata when their existing (already approved) kata have open issues.

  • Default User Avatar

    My understanding is that not all kata on codewars have been through the beta process, maybe I'm wrong. By the time I indicate that a kata has an issue, I've already wasted a ton of time on it, and the worst thing that happens to the author is that he/she needs to fix the kata. The user who discovers the issue should get honor points and the author should be restricted from writing new kata. Authors should also be required to respond to kata issues within a certain timeframe. Kata quality is far more important than kata quantity.

  • Default User Avatar

    Right now the site incentivizes creating bad kata, while providing very little recourse against bad kata - not even a downvote button! As a result, kata rank is inversely proportionate to the kata writer's English ability when it should instead be based solely on the coding ability or computer science knowledge required to solve it.

    I understand that specifications should not always be exact, because they are not always exact in the real world. However, unlike the real world, we are unable to address the situation in which the tests are wrong. In the real world, when a test is wrong, we simply view the test code and fix the test. In code wars, we must mindlessly guess and check for how the kata writer wrote his test, even when the test requirements conflict with the specs. I think code wars is a great idea, but because of this one flaw, there are much more efficient ways to level up your coding ability.

  • Default User Avatar

    I am passing every test except for: "Depth implemented recursively" and "Count implemented recursively." Obviously I am using recursion, I just don't know how to get the tests to detect it. I have tried multiple different variations, including doing the recursion inside of a closure with side effects, tail recurison, etc.

  • Default User Avatar

    Closest thing to a real world solution :)

  • Default User Avatar

    Haha this was the only solution posted here that made me smile. But your count function doesn't accomodate for multi-digit values of data.