Ad
  • Custom User Avatar
  • Custom User Avatar

    Duplicate as mentioned below, this kata should be unpublished by a mod.

  • Custom User Avatar

    This is a duplicate of https://www.codewars.com/kata/599da159a30addffd00000af
    Or, since this thing is ancient, the other way around.

    I like this one better. Classes provide a nice code structure and improve readability.
    The getX and getY methods are not necessary, when you can access the x's and y's of the center directly.

  • Custom User Avatar

    Input validation was taken out of Java version, but not JavaScript version. Unfortunately, the description was updated for Java and JavaScript.

    Example test was added. Just the one, but it'll do.

    The inputs are basic Objects {center:{x,y},radius} - that's not too hard to get at. Object deconstruction works, with renaming.

    I stand by my points about the return value for invalid input ( though input validation should just be taken out, and it won't be a problem then anyway ), and especially zero radius circles.

    Both kata author and translation author have gone missing. I'd have edited the input validation out of JavaScript but that would have left the zero radius circle problem, and Java actually still has input validation, not with argument properties but with whole arguments missing. That means you still have to do input validation. So the kata will remain broken.

  • Custom User Avatar

    the JavaScript version still requires input validation

  • Custom User Avatar

    Local tests are not (or wrongly?) implemented.
    Edge cases are not in description.
    Return value for edge cases does not make sense (should be distinguishable from not-a-collision).
    Zero radius circles are simply points, which can collide (I do not see your point. nested circles collide, don't they? what's different when the inner circle has a zero radius?).

    Also, unnecessarily hard to get at values. Adds nothing to kata logic.

    When all the fluff is handled, it's a nice little kata that showcases a basic piece of math. But there's more fluff than business logic here.

  • Custom User Avatar
  • Custom User Avatar

    I have removed the "Notes" from Kata description as this doesn't apply anymore beacause I have removed the input validation. Read the comment from sakana378.

  • Custom User Avatar

    Input validation and its test cases are removed. I also removed the "Notes" from Kata description as this doesn't apply anymore.

  • Custom User Avatar

    I totally agree with you guys! I will remove the input validation and the tests that cover this feature.
    Instead, for the sake of good programming habit, I will throw an exception in Circle() in the case when the input is invalid.

  • Custom User Avatar

    It's very interesting to hear that perspective from a 1 kyu, because I half-expected my comment to be dismissed as whining. :)

    I can see where this kata would be very interesting to young people who aspire to creating games. I had to deal with collisions in some enhancements I made to the helicopter game in my beginning Javascript course at CodeHS.

  • Custom User Avatar

    Agreed.
    Such edge cases should be validated in Circle class.
    Collosion detection should focus on what it should do, instead of what it should not (e.g. validate a Circle object).

    I appreciate the motivation of the author to ensure that everything passed in is fine. But it does not agree with the OOP thought.

  • Custom User Avatar

    I'm not very fond of edge cases that make no sense (like non-numeric or negative radii, etc.), but otherwise, this was an enjoyable and challenging kata.

  • Custom User Avatar

    Now I see, you are referring to the "Notes" section of the Kata description. Right. I will add a necessary info to this section to be clear.

  • Custom User Avatar

    No, I mean "Validate the input!" is not enough description for making correct solution (without clicking submit button).

  • Loading more items...