6 kyu

Markings to White Triangles and How to Find Them

Description
Loading description...
Mathematics
Fundamentals
  • Please sign in or sign up to leave a comment.
  • dfhwze Avatar

    DO random tests still work in Coffeescript?

  • FArekkusu Avatar

    Python 3.8 should be enabled.

  • bouchert Avatar

    The description says Somehow, I knew the third triangle had its first side unmarked, rather than its second, I'll have to take that into account were I to do this right., but without any diagrams or specification, this doesn't provide enough information to solve it. "First side" and "second side" don't have standard meanings. It's certainly not sorted by length, because in one of your examples, a>b. So even though I guessed correctly that 'c' is always the hypotenuse, it would be a bit fairer to tell us this in advance.

  • Voile Avatar

    Approved

  • omaraloraini Avatar

    Well Done, I had to use reflection to figure out the names of the fields. Really enjoyed reading the description, thanks for the kata!

  • JohanWiltink Avatar

    Welcome to CodeWars, and congrats on your first kata. I love the storytelling! :smile:

    Unfortunately, technically, there are issues with it. :pensive: These are not new issues, but unfortunately there is not really one place to learn about them. Solve more kata, read the comments, and you'll come across more information. There is Test framework documentation and there is the Conjured Codewars Codex, but both are incomplete and outdated. I have mentioned some undocumented features in the issue comment. If you can't figure out how to use them, read other kata's random test cases, where they are sometimes used, or ask.

    However, well done on the random tests. That's a problem with a lot of first kata, but not yours!

    • theropodMusings Avatar

      Thank you for your kind feedback! I just started codewars yesterday and am excited to try my hands on creating a kata of my own. I learn best by doing, and this is all a learning experience for me.

  • JohanWiltink Avatar

    If you're going to be asking for floating point values, you really should allow for a margin of error. I am apparently using a different calculation than the reference solution, and ~10% of my answers is off by less than 1e-9, but are rejected for that. You could have used assertApproxEquals if it weren't for the wrapping in objects.

    Also, when asking for objects, insertion order should not matter. { a:1, b:2, c:3 } should be as good as { c:3, b:2, a:1 }, I should think. You could have used assertDeepEquals instead of assertSimilar but for the floating point issue.

    You will have to write a custom assert wrapper function.

    • theropodMusings Avatar

      Thank you for the feedback, I'll get on to it! ^-^

    • theropodMusings Avatar

      Javascript object attribute comparison is now no longer order sensitive.

    • theropodMusings Avatar

      Javascript kata now test floats with an epsilon of 0.01.

      I've hopefully solved both issues on the javascript kata.

    • theropodMusings Avatar

      Changes migrated to coffeescript kata.

    • JohanWiltink Avatar

      These issues are solved.

      Your random testing is vulnerable to input modification by the user solution though, see here. :yum:

      Sorry I didn't mention that earlier.

      You can fix that by passing the user a copy of the input (Object.assign([],triangle)), or by calling the reference solution first and storing the result for later comparison (in which case, make d*mn sure your reference solution does not modify its input, as yours is doing if I'm seeing things correctly. or pass it its own copy).

      Writing test cases for even an 8 kyu kata can be a 1 kyu kata in itself .. :yum:

    • JohanWiltink Avatar

      Good job on the assert wrapper BTW. Fast too!

      I fixed a parenthesis and a spelling error in Preloaded. Hope you don't mind. (You can review the changes in the Kata Editor under Revisions.)

    • theropodMusings Avatar

      Thanks!

      I don't mind, I allow contributors for a reason. ^-^

      I invalidated your solution btw. ;)

      Anything else you spot?

    • JohanWiltink Avatar

      Not spotting anything else, no. Couple more rankings and ratings and it's ready for prime time. Writing tests is fun, isn't it?

      Issue marked resolved by JohanWiltink 8 years ago
    • theropodMusings Avatar

      Very.

      May I still add additional languages after this goes live?