Retired

Whisker's Lives (retired)

Description
Loading description...
  • Please sign in or sign up to leave a comment.
  • natan Avatar

    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.

    check_cat_life(['Curse', 'Life Orb', 'Life Orb'], 1)
    

    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.

    check_cat_life(['Curse', 'Challenge', 'Life Orb', 'Life Orb'], 1)  # Alive?
    #                        ^^^^^^^^^^^
    #                -1, thus fine to not immediately get Life Orb
    

    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.

    check_cat_life(['Curse', 'Healing Potion', 'Life Orb'], 1)
    

    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.

    • Abiyasash12 Avatar

      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:

      check_cat_life(['Curse', 'Challenge', 'Life Orb', 'Life Orb'], 1) -> 'Dead'
      

      This example should be alive:

      check_cat_life(['Curse', 'Life Orb', 'Life Orb'], 1) -> 'Alive'
      

      For this example:

      check_cat_life(['Curse', 'Healing Potion', 'Life Orb'], 1)
      

      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.

      Question marked resolved by Abiyasash12 5 months ago
    • dfhwze Avatar

      Please note that it's futile to fix a kata that has been retired.

  • dfhwze Avatar

    Next statement that is not clear:

    Feast: Prevents the next Death Whisker gets. Doesn't have any effect on lives. Note: this doesn't prevent Curses.

    Does this include "Death" powerup when Whisker is already dead, or only when alive?

    • Abiyasash12 Avatar

      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.

  • dfhwze Avatar

    What does this mean?

    Life Orb: Increases lives by 1. If this is used as soon as Whisker gets to 0 lives, then he will go to 1 life.

    • dfhwze Avatar

      Is this some negative life shenanigans:

      (5, ['Feast', 'Death', 'Death', 'Challenge', 'Curse', 'Life Orb'])
      'Alive' should equal 'Dead'
      
    • dfhwze Avatar

      in hindsight, this has to do with the "as soon as" condition

    • Abiyasash12 Avatar

      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.

  • HerrWert Avatar

    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."

  • mauro-1 Avatar
    powerups = ['Challenge', 'Challenge', 'Curse', 'Healing Potion']
    lives = 4
    
    => "'Dead' should equal 'Alive'"
    

    Why?

    Challenge: 4 => 1
    Challenge: 1 => 1
    Curse: 1 => -1 (dead)
    Healing potion: "can't be used to resurrect Whisker" => still dead
    
  • rowcased Avatar

    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.

  • rowcased Avatar

    Incomplete Testing for this incorrect solution.

    1. There are no Fixed Tests that will fail this incorrect solution.

    2. Random Tests only intermitently fail this incorrect solution.

    • Abiyasash12 Avatar

      which tests? give me an example

    • rowcased Avatar

      I gave one in the original Issue. You should not close issues until the problem is corrected.

    • Abiyasash12 Avatar

      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.

    • hobovsky Avatar

      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.

    • Abiyasash12 Avatar

      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.

      Issue marked resolved by Abiyasash12 5 months ago
    • dfhwze Avatar

      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.

  • rowcased Avatar

    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:

    powerups = ['Death', 'Death', 'Life Orb', 'Death', 'Challenge', 'Healing Potion']
    lives = 2
    
    • Abiyasash12 Avatar

      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.

      Issue marked resolved by Abiyasash12 5 months ago
  • rowcased Avatar

    Random Tests are subject to illicit shenanegans.

  • Abiyasash12 Avatar

    Let me know if there are any problems or issues!

    Most importantly, give me feedback.