Retired
Whisker's Lives (retired)
5 of 13Abiyasash12
Loading description...
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.
Can whisker be brought back from -1 lives with two consecutive Life Orbs? Description seems to allow it (because it says immediately after reaching 0 rather than immediately after going below 1, and reaching 0 happens the turn after being negative), and reference solution says yes. My solution said no but wasn't rejected.
Also, that would mean that it should also be allowed to be at negative lives for multiple turns and then come back to life, as being negative life doesn't trigger permanent death unlike being at 0 life - but the reference solution does not allow that, making the reference solution wrong either way.
Furthermore, using Healing Potion at -1 lives is ambiguous, I interpret the description as that whiskers will be brought to 1 lives but still be dead, as it DOES increase lives by 2, but does not resurrect. Alternatively, that whiskers never dies as a result of not having been at 0.
Actually, that's a problem in itself. The description does not state under what conditions whisker is considered dead and alive respectively, except for the example that mention 0 as a dead state, but without saying anything about positive or negative values.
Sorry about that. I just fixed that.
You should be able to see in the description now that Whisker can in fact get two consecutive life orbs and get back to 1 life.
This example should be dead:
This example should be alive:
For this example:
It should be dead because the healing potion shouldn't have any effect. It won't increase the lives by 2, it won't resurrect. Only the life orb can resurrect, but since the life orb isn't used as soon as Whisker gets to -1 lives, Whisker is dead.
Please note that it's futile to fix a kata that has been retired.
Next statement that is not clear:
Does this include "Death" powerup when Whisker is already dead, or only when alive?
Only when alive. If he is dead (0 or less lives), you should return 'Dead' (unless the next powerup is a Life Orb), and the Death shouldn't have any effect anyway.
What does this mean?
Is this some negative life shenanigans:
in hindsight, this has to do with the "as soon as" condition
This is negative life shenanigans. If Whisker reaches 0 lives, a life orb can be used to resurrect Whisker (but not a healing potion)
Consecutive life orbs can also bring Whisker back from say -1 lives to 1 life.
Some might be wondering about the possibility of a negative number of lives (e.g., if Whisker starts with 1 life and then gets cursed). I accounted for this possibility in the way I wrote my solution, but it would probably be better to incorporate it into the description. So where it mentions reaching 0 or getting to 0, it might be better to say "0 or less."
Fixed!
Why?
Let me check. I thought I fixed this.
I have fixed this issue, it was a small error of == and <=.
Thanks to you, I also added this one as one of the fixed test cases.
Please let me know if there are any additional errors.
Random Tests are subject to user manipulation.
This can be prevented by sending a new copy of an input list to the user solution so that if they mutate that list it will not effect the original data thus the outcome of testing.
You should not close the
Issue
until the problem is corrected.I have prevented user manipulation.
The code you linked under user manipulation doesn't work anymore.
Incomplete Testing for this incorrect solution.
There are no Fixed Tests that will fail this incorrect solution.
Random Tests only intermitently fail this incorrect solution.
which tests? give me an example
I gave one in the original
Issue
. You should not close issues until the problem is corrected.The original Issue isn't an example. This one fails only because of the reason I listed below. If you fix that, then that test case always works.
I validated my solution hundreds of times, and it's working. I don't know what to do.
The problem is not with your solution, but with tests. What rowcased means is that the solution he linked is WRONG, but it passes all tests. Tests are insufficient. The way to fix it is to do two things:
a) add a fixed test for scenarios not handled correctly by this solution, and
b) make sure that random tests always generate random inputs of the kind not handled correctly by the solution.
Sorry, I have noticed some errors in my code and fixed them. I ran 1 million test cases (for real) and they all passed.
I'm marking this as resolved.
Sorry for any inconveniences.
It's still possible to solve this kata with an incorrect solution. You need to make sure to generate all kinds of edge cases in random tests.
Your random testing only sometimes produces a test case which fails this solution.
Here is an example from the random test generator that does make it fail:
The Life Orb revives the cat after it dies, but the Healing Potion can't do that. Once the cat reaches 0 lives, it should return 'Dead' if the next powerup isn't Life Orb. If it is Life Orb, then you should add one, like it happens at index 2.
Random Tests are subject to illicit shenanegans.
I think this is just the misunderstanding that I've pointed out in your other comment.
Let me know if there are any problems or issues!
Most importantly, give me feedback.