5 kyu
Find the "center" point
55 of 68myjinxin2015
Loading description...
Puzzles
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.
should be
done
needs
Node 14.x
andassert.deepEqual
done
thanks for your efforts, could you take a look at multi level sorting that you recently upgraded to Node 18 ?
when you use
assert.deepEqual()
you almost always needchai.config.truncateThreshold = 0;
(also forstrictEqual()
on long-ish strings). currently the test's output looks like this:which makes it hard to debug. also, the random tests generate records that are missing certain keys, but i dont know whether you wrote them, as the fork has no diff.
(I would have posted this on the fork, but I get the good old "Comment Owners is invalid" error ...)
If I leave the spaces in the random tests fail.
If I take the spaces out the static tests fail.
When using
Math.hypot(dx, dy)
tests succeed. When usingMath.sqrt(dx*dx + dy*dy)
one static test fails. I have not looked into rounding intermediate results to six figures after the decimal point.I do think you should specify in the description spaces should be taken out.
I haven't thought hard enough about how and why
Math.hypot
andMath.sqrt
differ, and how to solve that. But fixing that somehow, if possible, would probably be a good thing.I'll improve later ;-)
Description update ;-) Something more clear: Do not calculate the distance with the spaces; rounding to 6 decimal place when compare distance.
But I don't know why
If I take the spaces out the static tests fail.
Math.hypot(dx, dy) and Math.sqrt(dxdx + dydy) should got same result, isn't it?(I'm not test for it, perhaps later ;-))I absolutely agree. It should work.
Also, world peace and free beer .. :P
;-)
Manhattan distance or Pythagoras distance?
Pythagoras apparently.
This comment has been hidden.
I'm a little busy right now, I will have a test later. I guess it's because I didn't calculate the distance to the space.
In my calculations, all the numerical values are almost half of the difference. I guess you calculate space as 1. And based on my true intentions, the spaces are not calculated from the distance. That is: From one point to the next, the distance is 1. For example:
In this matrix, the distance from A to C is 1, right? So, the distance from A to B is 1 too. Do you understand?
But it's really a bug in my description, because it's not clear. So I'll fix my description ;-)
Description update ;-)
Thanks. Ignoring the spaces and rounding to 6 decimal spaces before comparing made it pass :)