Ad
  • Custom User Avatar

    I think there is 1 such kata (can't find it).

  • Default User Avatar

    is there a kata that has excellent random distribution checking?

  • Custom User Avatar

    I was able to solve using Math.random and not implementing my own algorithm.

    I don't think this is an expected behaviour, passed using Java.

  • Default User Avatar

    hard to tell with codewars diffs being what they are, but I think you messed up the description

  • Default User Avatar

    You have to create a function named one_two

    uhm, no? no.

  • Custom User Avatar

    Crystal translation severely misuses testing framework and uses it blocks in a totally wrong way.

  • Default User Avatar

    Nice one, well done, congratulations for the kata.

  • Default User Avatar

    C#

    There's a problem with the tests checking even distribution - my passed solution is definitely not providing an even distribution...

    Having had a look at the relavent test in the Sample Tests, I think its a simple integer division issue:

    This checks for the distribution on '1's:
    Assert.Less(Math.Abs(Integers.GetValueOrDefault(1, 0) / Length) - (1 / 3.0), Threshold);

    However the number of 1s held in Integers.GetValueOrDefault(1, 0) is not being cast to double. Therefore when its divided by the total number of digits held in the integer Length, it comes out to 0. And since the Asserts are only failing when they find a proportion greater than 1 / 3 (which would be fine if the first calculation was correct), its passing everything.

    Casting Integers.GetValueOrDefault to double in each Assert should fix it I think.

  • Custom User Avatar

    approved

  • Custom User Avatar

    It was defensive, I'm guessing you feel personally attacked as your update has allowed this loophole. Sorry it wasn't personal but the idea of getting annoyed at a user because you left a loophole seems naive to me...

    I haven't been coding long but I've enjoyed solving these little problems on CW and I've learnt a lot thanks to it but if this is enough to get banned I don't really care.

    Hopefully somebody comes along with better update that closes this and I'll have another go in the future. It looks like another commenter may have done just that but I'm not skilled enough to say whether everything is fine.

    Anyway thanks for making my first attempt at feedback such an unpleasant experience, with any luck the next time will be better or I just won't bother. Maybe you should have a think about what actually makes CW a worse place?

  • Custom User Avatar
  • Custom User Avatar

    Oh, that wasn't defensive, that was full-on offensive. I was calling you a cheat.

    This kata was authored when restricting Math.random was possible. Maybe it should be retired, instead of updated to the current version, after all. And maybe you should just be banned.

    ETA: I did not much expect, but at least hope, that people would actually read the description, and follow instructions. Why would you insist on making CW a worse place for everybody, where restrictions have to be enforced? Why do you feel the need, the need to cheat?

  • Custom User Avatar

    if the tests pass then I don't see how you can expect this to not happen.

    I thought the feedback might be useful, no need to get defensive.

  • Default User Avatar

    Could anyone recommend some topics to study to understand this?

  • Custom User Avatar

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

  • Loading more items...