Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Duplicate as mentioned below, this kata should be unpublished by a mod.
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.
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
Object
s{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.
the JavaScript version still requires input validation
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.
Thanks!
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.
Input validation and its test cases are removed. I also removed the "Notes" from Kata description as this doesn't apply anymore.
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.
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.
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.
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.
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.
No, I mean "Validate the input!" is not enough description for making correct solution (without clicking submit button).
Loading more items...