Ad
  • Custom User Avatar
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    You cannot have a flush and a pair. Your example has two deuces of diamonds. That would be an illegal desk.

  • Default User Avatar

    Sorry, I only changed the "SUBMIT" tests...

  • Custom User Avatar

    Yay, so much better now! Thanks! But example tests seem to be not updated :)

    Changing my vote right away!

  • Default User Avatar

    I modified the testing function in C++. I hope you will have a look to see if it is correct.
    Thanks for your help and your kind posts!

  • Custom User Avatar

    About kata/tests:

    • Default assertion messages seem to display values with 6 digits of precision, while kata requires 7. That's why I (and not only me, as it seems) get really useless message of Expected: equal to 1.14665, Actual: 1.14665 while values are Expected: 1.1466510000000001, Actual: 1.1466509999999999. It would be really helpful if tests provided customized (instead of default) assertion messages with better precision of actual/expected.

    • Truncation is really not helpful, because value like 1.146651 expected by one of the test... simply does not exist. It cannot be represented by double value, and it can be either 1.1466510000000001 or 1.1466509999999999, but there is no such value as 1.146651, no matter how much you'd like to truncate it. Even if you do double foo=1.146651;, foo is not equal to 1.146651, but 1.1466510000000001.

    • Ad "[...] the variety of solutions through all languages seems to show that with 6 decimals there is no need to do the calculations in the same way original solution does nor to use tricks" - would you be so kind then to take a look at my solution and tell me what exactly I do wrong that my result misses the expected value?

    But as you say, you created the kata long time ago, and you probably know all of this now. Problem is that you've probably long forgotten about the issues, but new users still encounter them, and get frustrated. I really mean no offense, I really do not mean to attack you or anything, but all I want to do is to warn potential users who would want to solve the kata, and leave some remark for those who would like to author a kata so they could see what to avoid. I do not mean to bash you, nor to bash the kata - just trying to leave some info others could find useful. I did not even expect any particular feedback, and honestly I even thought that if I would get any, it would be rather something like "GTFO", or similar ;)

    And your dedication and contribution to CW is much bigger than mine. Really appreciated.

    Regards!

  • Default User Avatar

    When I first wrote this kata (3 years ago) I wanted to put in evidence some rules when calculating with doubles:

    • with a bit of math simplify the expression as much as possible
    • avoid numbers too big (e.g. factorials)
    • avoid to multiply by a number the result of a division to abstain from multiplications of errors (though here it doesn't seem to make a difference in the tests).

    Maybe I was wrong about these aims... nobody is perfect!
    I knew there would be discussions about the tests with no tolerance so I have limited to 6 the number of decimals of the truncated result; the variety of solutions through all languages seems to show that with 6 decimals there is no need to do the calculations in the same way original solution does nor to use tricks. Nevertheless in some more recent translations I introduced a tolerance with a custom "assertFuzzyEqual" test function.
    I think C++ tests are not "screwed" (though maybe more difficult than in the C version) since several guys passed with different kinds of code.
    Sorry for this long advocacy.
    PS: @hobovsky -> thanks for your dedication to CW!

  • Custom User Avatar

    EDIT: C++ version of the tests was fixed, assertion messages are better and there are no more strict comparisons.

    ~ Test suite in C++ version is screwed because a) assertion messages truncate results a few digits shorter than actual requirement, so you cannot see what you did wrong, and b) it uses strict comparison in assertions, what is incorrect even for truncated values, because it depends on the way how you truncate/round/order of operations/many other factors.
    To have your C++ solution accepted, you either have to perform calculations in almost exactly the same way original solution does, or refer to some tricks like round via string representation with precision of 7 digits and hope it gets expected double value.
    Or just skip C++ version and go straight to C, because there tests use proper(ish) tolerance comparisons. ~

  • Default User Avatar

    i think the test might be wrong

    You think or you are sure:-) Can you give an example? The reference solution returns "Not enough..." when n is greater than the number of participants.
    Moreover I am astonished since 164 guys passed the C++ kata and nobody would have seen that?
    You have (well?) solved the kata so now you can look at the tests and at the reference solution so you will maybe have a better view. Cheers.

  • Default User Avatar
  • Default User Avatar

    Did you ever get an answer to this? This was the first require I've seen in a solution and I was sort of wondering the same thing.

  • Custom User Avatar

    It reverses the array/string.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution