Ad
  • Default User Avatar

    Nope, for people who are kinda experienced it's pretty easy to write one-liners from scratch.

  • Custom User Avatar

    should be clearer now.

  • Default User Avatar

    Agreed. It could be a valid trap teaching input validation if you also needed to handle null, empty strings, and strings without space, but then it wouldn't be 8kyu. And then the description could use a "WARNING! Some input validation may be required" thingy.

  • Custom User Avatar

    Look more like it's on the harder side of 7 kyu to me.

  • Custom User Avatar

    I thought this was my rolling dice code. Do you mean the code should act as proof to my friends that the dice roll is legit and fair? Then add an apostrophe (mate's). Otherwise I find that statement frankly a bit unnecessary. Just write "Return False if the argument is not an integer or smaller than 1"

  • Custom User Avatar

    Thank you.
    PL

  • Custom User Avatar

    Why the multiple return type is unacceptable?

    It's not unacceptable, but it's usually a very bad coding practice, for a couple of reasons. It's not how functions should usually work, and it's not how error reporting/handling is being done.

  • Custom User Avatar

    OK. Got it.
    Thanks for a nice explanation - I appreciate it.

    That was a good lesson.
    Cheers
    PL

  • Custom User Avatar

    @Piotr_L, neither your code can be used in real life.
    You should take into account, that your randomness validation allows for MANY ways to have predetermined result, which would ruin the fun for playing DnD.
    Here is one example of such predetermined result: https://www.codewars.com/kata/reviews/604f2f9b1c740500019fc744/groups/604f34e6306499000192ea3f

    The best way to go for you would be to actually read wikipedia about preudo-random numbers and randomness tests, that are applied in real life.
    And also solve more katas, to get hand about the appropriate standards of what is good/bad, what is interesting or not.

    Apart from the obvious issues, your kata has other disadvantages:

    1. You allow user to use random/secrets, which makes the task absolutely not challenging and thus many people would downvote it.
    2. You only use die 1d6, which is not how it works in DnD. They use many dice NdM, you could have enhanced your kata with that.
    3. You include irrelevant details, such as input validation, which does not go along with the rest of the challenge. Read about kata best practices: https://github.com/codewars/codewars.com/wiki/Kata-Best-Practices
  • Custom User Avatar

    @Piotr_L

    Is it likely that somebody would ever do roll_the_dice(-10) ? It just doesn't make sense. Input validation isn't bad, it just doesn't add anything here.

  • Custom User Avatar

    Well...
    Still do not get why this input validation is so bad... and causes issue comments... it test the code and gives clue what the task is about...
    I was trying to find similar Kata... none of them was a code that could be used in real life.
    Yeah... the forecast for my Kata is not optimistic :) This is my first try... quite dissapointing :)
    Thanks for feedback

  • Custom User Avatar

    I meant the code should deal with inputs which is not a positive integer... this is what I would put into my friend's rolling dice code...

  • Custom User Avatar

    The code must be your mates proof and return False if the given parameter is not an integer number or if it is 0 or negative.

    I don't understand what "The code must be your mates proof" is supposed to mean. Also: "parameter" should be "argument".

  • Custom User Avatar
    • Input validation is a worthless requirement and should be removed
    • There're already several katas about generating random data, so it's a duplicate

    The previous kata was quickly retired, surely you don't think an exactly same thing will survive for long?

  • Custom User Avatar

    I do not get it...
    Why the multiple return type is unacceptable? I will improve input checking...
    I think I have fixed the randomness check... can you show a non-random solution passing the test?

  • Loading more items...