4 kyu
Compute a convex hull
297 of 433dustryder
Loading description...
Algorithms
Geometry
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.
Rust translate
python new test frameworks
Merged
This comment has been hidden.
For those attempting this Kata without outside help, assuming all points are part of the hull and then reducing them is the WRONG approach. It will work, but it's not performant enough (at least for some languages) and you will time out.
Python submission Attempt test cases are all failing; the input and output are switched places. I copypasted them to my own tests: they pass, the test data itself is ok.
Meanwhile the given Sample tests are working correctly.
Thank you for this interesting Kata!
Elixir translation.
Hey guys, regarding the Haskell translation, in one of the hardcoded tests it expects a hull of [(1.0,20.0),(5.0,6.0),(6.0,20.0),(15.0,19.0),(19.0,4.0),(20.0,4.0)], which doesn't make sense...? Going from first to second to third means turning left, and from second to third to fourth means turning right, but should't we only turn in the same direction? Or am I missing something?
The test solutions have been sorted to account for differing methods and starting vertices
Oh, that makes a lot of sense! Thank you.
Random test solutions appear to be wrong (python). one point is always missing, which belongs to the convex hull. e.g. ([points],[given solution],[Real convex hull]): ([[86, 42], [78, 14], [68, 22], [25, 66], [94, 10], [6, 40], [30, 9], [14, 63], [12, 80], [36, 60], [28, 15], [67, 39], [31, 36], [38, 76], [9, 49], [29, 59], [8, 70], [98, 83], [80, 96], [63, 27], [74, 10], [79, 69], [59, 9], [42, 80], [81, 59], [19, 39], [48, 35], [92, 34], [70, 33], [72, 84], [51, 56], [85, 56], [49, 66], [41, 95], [54, 43], [72, 64], [98, 82], [36, 30], [53, 22], [83, 27], [5, 52], [72, 21], [53, 88], [44, 33], [33, 81], [32, 21], [79, 8], [24, 80], [25, 97], [68, 19]],[[5, 52], [6, 40], [8, 70], [12, 80], [25, 97], [30, 9], [79, 8], [80, 96], [94, 10], [98, 82]],[[5, 52], [6, 40], [8, 70], [12, 80], [25, 97], [30, 9], [79, 8], [80, 96], [94, 10], [98, 82], [98, 83]])
Confirmed. Though, it seems you found a rare edge case, because I check the original solution against one that solves this case correctly and I couldn't make it fail. Well, I replaced the internal solution with the good one, should be good, now.
okay let me emphasize that every randomly generated testcase has a wrong solution. Here you have another example: ([points],[given solution],[Real convex hull]): ([[96, 56], [48, 33], [17, 73], [57, 7], [14, 17], [31, 46], [54, 47], [48, 95], [89, 96], [75, 15], [96, 87], [33, 69], [17, 41], [76, 97], [75, 99], [77, 20], [57, 52], [90, 41], [96, 83], [42, 26], [66, 84], [26, 33], [28, 45], [59, 76], [44, 9], [45, 53], [22, 33], [31, 62], [31, 94], [49, 92], [76, 60], [40, 37], [41, 70], [98, 18], [29, 78], [80, 25], [60, 6], [81, 56], [82, 24], [56, 26], [16, 83], [88, 75], [57, 9], [62, 7], [72, 12], [93, 48], [24, 79], [97, 17], [27, 41], [91, 44]],[[14, 17], [16, 83], [31, 94], [44, 9], [60, 6], [75, 99], [89, 96], [96, 87], [97, 17]],[[14, 17], [16, 83], [31, 94], [44, 9], [60, 6], [75, 99], [89, 96], [96, 87], [97, 17], [98, 18]])
Have you reset the kata? The current reference solution returns the second array ("real convex hull" as you call it).
So, you're the kind of guy who downvote the other one who tries to help you? Maaaaaan, that's pretty fair, don't you think? Especially when that guy isn't even the author of the kata or the translation and just take on his time to help you...
FYI, I just checked again, and the solution I used to replace the original one returns your """real convex hull""" as it should. So I don't know what is the problem, but I'm sure of one thing: this time it's on your side. I just changed one thing more, so that the expected value is computed before your function even touches to the data... Just in case you're actually mutating the input without even thinking about it and then reject the fault on someone else...?
Hey Blind4Basics, I don't want to offend you personally and so would I urge you not to either. But I'll describe what made me downvote yesterday.
C# translation available. Please review and if you like it, I can prepare other ones (Java, C, C++).
Crystal translation is virtually identical to the Ruby translation; awaiting approval.
Haskell translation
.
Ruby translation available here. Could someone take a look?
I don't really know Ruby, but it looked good. Approved.
If any issues should arise, please post them in this thread as well, so translation author will see them.
JavaScript translation ready! Waiting for approval...
Could someone review the translation? The author is inactive now.
I was so lucky to write this while you were online. Still got a couple blue ones pending, but no one cared to look at them after I shouted out again a few days ago -_-
post the links on the gitter channel, that will be more visible than here
needs random tests
Added
thx!
Are you still active?
Yep
Maybe when I have time I will propose you a translation:-)
Nice kata.
Starting code had method name
covex_method
but sample and final tests requirehull_method
. Starting function should behull_method
.corrected