Draft
Which path is the shortest?
46rinoma
Loading description...
Geometry
Algebra
Mathematics
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Calculating distance between 2 points is not a novel kata idea.
The CodeWars Test framework has an undocumented
assertApproxEquals
, which does more or less exactly what Donald's wrapper does.I have edited the first three fixed submit tests to use this.
Hope you don't mind.
Your test for rounding still has flaws. Hope you fix that.
Fixed :)
Hi, the kata is easy but OK.
The rounding is not correct. It rounds for instance 18.444524 to 18.45 instead of 18.44. I had to round twice (first to 18.445 and then to 18.45) to get it fixed.
NOTE:
The problem could have been avoided if you did not use the 'anti-pattern' for your random tests to:
Hope this is fixed at some point...
Fixed :)
Sometimes some testcases have rounding problems (see @donaldsebleung)... so in this case i mark it as an issue;-)!
Thanks :)
Good to see full test coverage including both fixed and random assertions but IMHO rounding isn't the best way to treat floating point values, especially how your reference solution rounds the values which causes my solution to disagree with yours (by
0.01
) around 10% of the time. You may want to import the customisedassertFuzzyEquals
assertion method into your Preloaded section instead and use it in the test cases like any other assertion method:Note: if you do decide to use this assertion method (which I recommend), do not do any rounding in your reference solution whatsoever and remove the rounding instructions from the Description.
Helped me so much thank you!!