6 kyu
Next Version
973 of 2,100AzariasB
Loading description...
Arrays
Strings
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
several very different ways to do this one. Some choose to treat the version as a number, and then build from there, while others clearly focus on managing it as an iterable. nice little exercise
Nice one, well done kata.
warning, the assertions must be inside a
it
block, not adescribe
one (fixed tests). It works both ways, but for further compatibilty, the wrappingit
is prefered.Done I didn't see a clear warning in the codewars documentation about that
Missing return type in initial solution setup of TS
It's more of a suggestion than an issue as it does not block in any way the resolution of the kata Fixed anyway
Python new test framework should be used
.
Ruby function name should be
snake_case
again, more of a suggestion rather than an issue Fixed
Description should be language-agnostic
This would mean removing examples, I'd rather not do that, even pseudocode is a language per se. Suggestions are welcome
Just this, maybe?
Ah nice, yes that's good, description updated, thanks !
JS: Node v12 should be used along with its appropiate assertion tools (Mocha + Chai). Refer to this and this
Updated to Node v12
Literally laughed out loud when I saw the solutions, the one thing I didn't try because it never occurred to me that the kata could be so easy.
Oh it was hard for me... 1:30 hour for this kata :D
console.log('Nice Kata')
For Python:
Can the author (or anybody) please advise why this test fails:
'2.9.7.6.6.9.8.2.7.8.0.4.0.7.7.9.8.5' should equal '0.2.9.7.6.6.9.8.2.7.8.0.4.0.7.7.9.8.5'
Why is a "0." being appended to the start of the string in this case?
Print the input, you're making a common mistake, check Cussc's post below.
Cheers Chrono79,
my solution was taking into account ".x" startng strings but not "0.x"
For Python some tests are incorrect:
'1.1' should equal '11' '1.1.0.0.0.0.0' should equal '11.0.0.0.0.0' '10.0.0' should equal '100.0' '10.0.0.0' should equal '1000.0'
Without the input values how do you know the tests are incorrect? The tests are ok.
Chrono, I changed my code for some reasons, but still have mistake for test value '1.1' as noticed earlier. It says: '1.1' should equal '11', but i ran my code for this test and got output '1.2' as it should be. So, maybe I missed something, but I don't understand what exactly.
Print the input, in that test, it is
10
. The first value of Python error message is not the input, it is the value your function returns.Got it! Thanks a lot!
The author should take a look at the TDD: random test a: ".7.9.8.1.3.2.7.1.3.7.4.6.6" should equal "0.0.7.9.8.1.3.2.7.1.3.7.4.6.6" random test b: ".7.7.1.3.7" should equal "0.7.7.1.3.7"
its not possible to derive a deterministic logic for such errors
The value on the left is what your function returned (not the input) and the other the expected value, it seems you're throwing away the zeroes. Could you elaborate? I guess you're joining the numbers as a string, converting that to a number (losing the leading zeroes) and adding 1 to that.
You are right. Converting to integer was my mistake Thanks:)
The authors solution is incorrect. It reverses the input if it does not contain dots... So authors solution treats strings "123" as "321", examples from other comments: "34" becomes "43", then "44" instead of correct "35" "76" becomes "67", then "68" instead of correct "77"
I have both correct and bugged solutions for this problem. So if there is someone, who can correct the kata you can use mine to fix it.
If that's in Haskell, there is already an open issue about it below.
Yes, that is in haskell. I have the solution, but I am new to codewars, so I don't know how to edit the kata(or to get proper permissions to do so).
Some power-user who knows Haskell could fix it I guess (not me).
Ok, I know Haskell, how do I fix it? Do I need some rep/permissions to do so?
Yes, you need the privileges (that comes with a lot of honor points) to edit the kata, or if you find a way to solve the kata anyway, you could try forking the Haskell translation with the fixed one.
Fixed
Thanks. The correct solution passes now.
One example in the description is misleading (just a typo):
nextVersion("0.9.9") === "1.0.0.";
There should be no "dot" at the end
Indeed Fixed !
Nice Kata :D
thx :)
@AzariasB
,Python 3 is unavailable. This can be fixed by changing both occurrences of
xrange
torange
.Thanks!
Fixed :)
Some random test cases in Haskell expects wrong values.
Example:
unVersion
matches the input I inspected withDebug.Trace.trace
, so the reference solution seems to expectnextVersion "34" == "44"
. The only explanation I can think of is that it's reversing the input (34 -> 43
) for some reason and incrementing that (43 -> 44
). Another example wasnextVersion "76" == "68"
.edit: Just noticed this unlabeled comment from 3 months ago mentioning the problem.
Indeed, there is something with reversing the string. I'm not skilled enough to do the haskell version of this kata, could you post your code so I can change the old one please ?
Sorry, I don't want my solution turned into the reference solution. I'm still a Haskell beginner so it's probably not great and may contain another bug. Also, I may sound selfish, but being tested against my own solution will ruin the experience for me :(
Is the translator inactive? Maybe we can wait a little, this person might be busy due to holidays or didn't get the notification.
Oh, all right, I understand that you don't want your solution being a reference. The issue was already detected, but the translator did nothing about it. So I assume he's inactive
The issue was first detected 3 months ago, but not reported until I did 2 days ago so I think it's possible that the translator is not aware of this issue.
When I find issues in translation, I try to also "reply" the translator's comment in the form "... translation kumited" but I don't see one for Haskell here. Some authors do the same when I forget to or when the translator doesn't react. Can you try to let the translator know by doing that?
Well, I can't contact him directly. So I don't know how I can let the translator know that the translation is wrong ...
Ok, I assumed that all translations are done through kumite and I thought you can leave a comment there. Sorry, I've never translated or authored kata, so I don't know how you communicate :(
Have you had any conversation with this person at all? Maybe you can reply to one of the past comments?
I've found a way to comment the translation (not easy to find though). We'll see what happens then :)
Thanks, I appreciate your patience and help :) Hopefully this person can fix the translation...if it's not fixed in few weeks or so, I might consider providing you my solution or maybe someone else can if they don't want to wait.
This was reported two years ago but it hasn't been fixed. Is there any way to do so without the translator's involvement?
Forking the translation and approving the new one is the usual way.
Fixed
This statement in description is wrong:
All numbers, except the first one, must not be greater than 10:
It implies that numbers can be equal to 10 (equal to 10 is not greater than 10). I suggest to change wording to "must be lower than 10".
Also, I think there is an important corner case missing of something like
99.9.9.9.9
. My broken solution passed while it shouldn't have passed for this case.You're right. I updated the description in consequence. About the second issue, I forgot to add another line in the description which states that the first number will always be lower than 100. So I also updated the desciption with this rule.
Well, some random cases actually have numbers much greater than 100. (Python)
Also, I think my broken solution would actually fail with a
98.9
case as well. Can you please add one case like this to Examples and to Fixed tests? P.S. Re-checked this, and my broken solution somehow works with that one XD Still, I don't think some additional cases will hurt.The problem is : it's going to invalidate a lot of solutions ...
I don't think it will, but if it will - so be it. Or change your statement in description to "first term will never exceed 10", for example.
Please do pay attention to random cases in Python, right now they contradict your description because some version numbers are like this: 1234149127. I think there is a typo and it should have been
'.'.join
instead of''.join
there.I updated all the versions to include the test case '99.9' (and '999.9' for some) and it seems that it did not break any existing solutions. And yes, in the python version, I replaced the
''.join
with'.'.join
Great!
And it actually did break some existing solutions, including mine which I considered correct. It fails on random cases like this:
current version = '9.0.2.8.5.2.0.9' '9.2.8.5.2.1.0' should equal '9.0.2.8.5.2.1.0'
So I suggest adding this corner case as a fixed test as well. (And probably '0.0.0.1' too!)
TypeScript-Translation kumited!
https://www.codewars.com/kumite/5810c7ed6ffab5f4720001a4
Please check and approve it. ;-)
Is there any problem with the translation?
Great kata. Thanks.
This comment has been hidden.
There is an issue with the Haskell validator. It expects a result different from the correct one, as you can see in the error message:
Falsifiable (after 19 tests): expected: "95" but got: "50" Version {unVersion = "49"}
Great kata! Thanks for the 2 points. Very satisfied.
"...if there are, you have to set it to 0 and increment the next version number."
Will you please give an example of this?
The second and the last examples of the code show you this.
9.9.9.9
9.9.9.(9 + 1) => 9.9.9.(10 >= 10 = 0)
and so on, hopefully that makes sense.
Approved :)
yay :)
This comment has been hidden.
PS, how do you feel about translations? I could easily write up translations for everything but Haskell and Closure (Meaning Ruby, CoffeeScript, C#, and Java if memory serves).
I could get those last two, it'd just take a lot more effort since I've not dealt with them much before. (I've played with Haskell a little, and Racket, which is like a cousin to Closure.)
Thank you for the python translation.
About the double solution writing, you're right, it's the same. I'm not sure, but the fact to write it as a global function makes me think that the user can then cheat and have acess to it. (I might be wrong thought)
Don't feel obliged to do the translations in other languages, if you don't fell very confident with the languages. I'd rather have a good translation later than a medium translation now :)
I don't think users can access anything you've put in the solution section. I could be wrong though.
I could do a good translation for Ruby and CoffeeScript without issue. C# and Java would involve profanity on my end. Haskell and Closure would probably melt my brain.
Well, since it's working pretty well now and I don't want to invalidate all the existing solutions, I will not change it (but I will no for futures katas).
Go for Ruby and coffeescript then ! :)
Please don't melt your brain, that's a horrible thing to do. I don't want to be responsible of that !
AzariasB, at this point we're the only two to have solved this. The details pave shows that there's only been one vote for this kata being ready (mine). Are you allowed to vote on your own kata?
This was a fun one. Didn't take too much effort to figure out. Just to screw with people you could throw them version numbers that need to be normalised like
1.2.11.19.38
which would come out to1.3.3.2.9
if I'm correct.I gave it a 6-kyu. Based on the descriptions I think it's obviously over a 7. I could easily see this being a 5-kyu as well based on the descriptions.
Thank you for your feeback. I did not vote for my own kata, I don't think it is possible.
I thought about "screw" the input and give "non-valid" inputs ... but as I said at the end of the description, all the inputs are basic valid inputs.
I don't see how this can become a 5-kyu ... can you please explain more this point ?
This comment has been hidden.