Ad
  • Default User Avatar

    Very concise and readable code, I like it 👍

  • Default User Avatar

    This is unbelievably shit. How did everyone else solve this in 10 lines??? :|

  • Custom User Avatar

    Extends range and coverage of tests

  • Default User Avatar

    If you know Swift and have time it would also be cool if you guys could vote on my Swift Translation. Thanks!

    https://www.codewars.com/kumite/63a9dde183e9d80bd5b11963?sel=63a9dde183e9d80bd5b11963

  • Default User Avatar

    Ah it's already approved, cool. Thanks guys.

  • Default User Avatar

    I couldn't quite follow @Madjosz's comment, but that's probably because I'm new to automated testing and codewars. I don't see any problem by shuffling the test cases, so that's totally fine with me.

  • Default User Avatar

    Hey markus, thanks for getting back! I feel pretty strongly about having at least one test case that tests a non-narcisstic number. Because the current tests would return that your program is correct if your program simply returns true for any input.

    I feel relatively strongly about not including the ^ operator hint, because I was confused by it at first and it's really just explaining a basic feature of the language. If you feel strongly about including it I would be fine with that though.

    Thanks also for your info on the PHP translation, that should then probably also be adjusted I guess

  • Custom User Avatar

    That's a good idea. I have never really understood how translations on CW should be done (I believe mine is based on PHP) and how to deal with issues that possibly affect multiple translations or even may have multiplied from translation to translation. So if anyone else could do something about it that would really be awesome.

    As some issues deal with the tests: I don't see any guidelines at CW how tests should be written. Having only few sample test inputs may make it more challenging in the long end. That's a matter of taste and it's pointless to have a discussion about it when there's no general definition of the scope that these sample tests should have.

    Personally I think that description, solution and tests are fine. The same is for my addition of a hint regarding the character ^ being an operator in Java, and thus should not be understood like that in the calculation. If that makes other people use words like "wtf" then these should go ahead and strive for their understanding of perfection in their own fork. Time is too valuable to be wasted for discussions about matters of taste here on Codewars, so I feel quite confirmed that it isn't necessarily a bad thing to come back here only once in a while. =)

  • Custom User Avatar

    Wtf, I didn't even see this "improvement" in the description.

  • Default User Avatar

    The original poster is probably inactive, so if anyone wants to fork this and implement some of the improvements mentioned in the comments that would be awesome!

  • Default User Avatar

    Also there is testRandomNonNarcissisticNumbers() which does test random shuffled numbers. But only non-narcissitic ones.

    I think it makes sense to test the narcissistic numbers in a non-randomized manner because we can easily list them all. And it makes sense to test the non-narcissistic numbers in a randomized manner because there are too many to list them all. But why are there two different test functions for testing non-narcissitic numbers? The randomized one and the non-randomized one? That seems a little redundant. Althought I guess it doesn't do any harm.

  • Default User Avatar

    In testExampleNumbers() it might be nice to have a few more numbers than 2. Because maybe the user's code randomly gets the right answer just for those two numbers, but is generally incorrect.

    Here are the sample test cases from the Haskell version:

    7 -> true
    12 -> false
    370 -> true
    371 -> true 
    1634 -> true 
    
  • Default User Avatar

    Why is 10 part of testEdgeCases()? Why is 10 considered an edge-case?

  • Default User Avatar

    What do you mean by "too obvious"? Why should the test cases be non-obvious? What problem would shuffling the testcases solve?

    Sorry if I'm not understanding something that is common knowledge I'm new to codewars and automated testing.

  • Default User Avatar

    The line in the description

    "(Hint: The ^ operator (exclusive or) is probably not what you want to use in your solution.)"

    feels a little out of place to me. I think that's something I would want to figure out on my own when trying to solve the problem.