Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Nope, for people who are kinda experienced it's pretty easy to write one-liners from scratch.
should be clearer now.
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.
Look more like it's on the harder side of 7 kyu to me.
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"Thank you.
PL
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.
OK. Got it.
Thanks for a nice explanation - I appreciate it.
That was a good lesson.
Cheers
PL
@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:
@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.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
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...
I don't understand what "The code must be your mates proof" is supposed to mean. Also: "parameter" should be "argument".
The previous kata was quickly retired, surely you don't think an exactly same thing will survive for long?
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...