4 kyu
Helpers For a 3DGame I: Biggest Triangle in a Sphere
209 of 291raulbc777
Loading description...
Data Structures
Algorithms
Mathematics
Logic
Strings
Geometry
Games
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.
Very interesting coding challenge.
That diagram is very nice :D
Looks like a character is missing in the formula? I also added some conditional rendering while I was in the description.
https://www.codewars.com/kumite/632f35eb91065f005c224595?sel=632f35eb91065f005c224595
Actually, here it is without
<code>
: https://www.codewars.com/kumite/632f35eb91065f005c224595?sel=632f3cc2defafd1039ec20a4This comment has been hidden.
I appreciate how clearly and in detail you state conditions of your katas, raulbc777. Good job! Keep it up!
Thanks @Mihail_Onuchin. I'm not
Julia translation
Approved! +1
Cheers!
The tests sometimes time out in Python due to input lists being too big - there's absolutely NO point in generating 70-80 points per test.
There should be fixed tests for such cases too.
There should be fixed tests for this, as my solution ignores this rule and passes most of the time.
My code runs out after 61 tests, i don't know how to improve it more!
Python 3 should be enabled.
PS:great kata sir, your katas made me to learn more about geometry
Done
Appreciate adding support for Python 3. Subtle changes but still necessary. Other than that, nice one.
Can we do a brute force solution? My code runs fine but it times out after about 48 tests.
Getting 55 out of 60 tests right, but there are always a few tests that just come out flat wrong, and there doesn't seem to be anything noticeably different about those cases.
I think this is quite hard for 4 kyu, but it was fun.
When I submit my solution I get error
(my result from attempt) Result: [165, 33.645207682521445, [[[1, 2, -4], [3, 2, 6], [-1, -4, 0]], [[1, 4, 0], [-1, -2, 4], [-3, -2, -6]]]] Test Passed (and then I get this error) [[1, 2, -4], [3, 2, 6], [-1, -4, 0]] should equal [[[1, 2, -4], [3, 2, 6], [-1, -4, 0]], [[1, 4, 0], [-1, -2, 4], [-3, -2, -6]]]
am I missing something?
When I try to submit my solution I get this error: Static Cases Simple Ones #
biggest_triang_int'
block (3 levels) in 'step'
block (2 levels) in 'Any idea what's wrong with my output? unfortunately I haven't seen such error in CodeWars before.
right. seems my code is missing validation for unreal cases. like not enough points to form trianges :)
Not sure if this should be marked as spoiler
In your description, the example case with
sphere_center = [1, 2, -2]
has the wrong answer. It says the result should be[4, 22.62741699796, [[-3,2,4],[2,3,5],[-2,-1,1]]]
but it's really[4, 22.627416997969522, [[1, 2, -4], [2, 3, 5], [-2, -1, 1]]]
(I am not complaining about the floating point difference, but rather the wrong points.)Also, in that same description, you use the variable name
sphere_center
above, but then just call itcenter
in the call tobiggest_triang_int
itself. And in the example beneath that, you define the list of points aspoint_list
but then when callingbiggest_triang_int
, you call itpoints_list
.And one final small issue...it unnecessarily complicates things that, if there's only one triangle, you are expected to return a list of three points (i.e., a list of lists), but if there is more than one triangle, you are expected to return a list of triangles (i.e., a list of list of lists). It adds extra mess to the code to not be allowed to simply return a list of triangle(s), whether one or many, and to instead have to special case the return structure for one triangle vs. multiple triangles. A strongly typed language probably wouldn't do it this way, and it feels like poor form even in Python, if this were a real utility function, to have to inspect the inner structure of the return values to determine whether one or multiple triangles were returned.
This comment has been hidden.
Thanks for this Kata!
Another really enjoyable Kata from you. I am not sure how to grade Kata like these. I gave it a 5 (working in python) because the actual python knowledge required for the solution is quite low, but, but, but you need to have decent maths etc. Thanks.
There seems to be an issue in the algorithm generating the random tests - the points provided are all out by 0.333333 or 0.666666, but the tests still expect the points to be integers:
(Expected: '[[16, -0, 0], [-8, 16, 4], [-10, -9, -13]]', instead got: '[[16.333333333333332, -0.6666666666666679, 0.33333333333333215], [-8.666666666666668, 16.333333333333332, 4.333333333333332], [-10.666666666666668, -9.666666666666668, -13.666666666666668]]').
Note that none of the expected values were in the
pointsList
provided, so the only way it was possible to pass the kata was by introducing a fudge factor (n => n < 0 ? Math.ceil(n) : Math.floor(n)
) to round the coordinates to ingegers.Let me check @stevehopkinson. You're the first one doing it in javascript.
This comment has been hidden.
All working as expected now. Cheers Raul, great kata!
Hi Raul, some new honor points for your "science fiction kata" and your leaderboard race;-)! Perhaps next time some spaceships arround this sphere (nice graphics!):-)!
Thanks Matthias for your time and solution (upvoted (+1)). I'll be working on an idea of a space shield against invaders. :)
Many thanks;-)! Good idea, really many aliens at codewars last days:-)!
The name Steffen is hovering round my head to serve as the saviour of the interplanetary force of justice. In terms of the security of the universe, no one compares like him.
Wow... may the force be with you (us)... Scotty, beam us up...:-)
"the saviour of the interplanetary force of justice"?? YEAH!!!!!!
Hi Raul, wrong place here, but congrats to your >10k and #11 - good job;-)! So have a nice day:-)!
Thanks Matthias, the same congrats for you that you surpassed the 10k. They are experimenting a new system of points, including the achievements with kyu levels. Perhaps in some days we'll have a surprise in the leaderboard :)
Thanks too;-), saw it yesterday (changing up and down;-)), so i'm curious about what will happen (and if really something happens, maybe it only was a test);-). But i don't expect that there will be big differences, would be strange to be on last place having 1 point tomorrow:-)...
Congratulations on 10k raul!