Ad
  • Default User Avatar

    sorry accidentelly flagged your comment unflagged it.

  • Default User Avatar

    i think it's because you did not check if bounce was equal to 1, which would cause an infinite loop, the same happened to me

  • Default User Avatar

    I interpret the instructions as she will always see the ball once no matter what because when the kid drops it, it has to pass in front of her before it can hit the ground then every time it bounces she will see it twice, once on the way up and again on the way down for a second bounce. I hope that helps.

  • Custom User Avatar

    For the puzzle, I tried to go from right to left and checking if the next left digit is larger than the previous one and if so it would replace it. I believe this is my mistake and I am not sure how exactly I should approach this. I am thinking rn if I first go left to right, then right to left repeatly for the length of the string till the number can not be re-oriented to be the smallest digit by swapping with its side numbers. Is this a good approach?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I tried doing something similar, but an issue came up saying it took way to long and I had to use another solution. Maybe I could have optimized another part for it to work. Anyhow, good work.

  • Custom User Avatar

    Im very confused about the instructions. It says that the mother can see the ball both when falling and bouncing. I am probably overthinking this but does the mother see the ball 2 times when it did one bounce because first it comes up and my understanding is it goes out of view and falls where the condition will apply that she saw the ball counting as 2 times.

    Or is it that the mother can see the ball the whole time it is above the value of the window but the ball goes out of sight as soon as it is lower than the window height? (If so, I would suggest a specification but I am overthinking this then a lot so even without it, it should be fine for most)

  • Custom User Avatar

    Good solution but u didn't really have to use list over str(num) but regardless, still good solution.

  • Custom User Avatar

    Just one final question, i have one last error, how would i view the testcase so I can figure out why the error is triggered?

    As mentioned above, you can log at certain actions done on the class methods.

  • Custom User Avatar

    I did it! thanks.

  • Custom User Avatar

    No worries, I was just like you when I was trying to solve this kata. Sat in front of my laptop for minutes, confused, until I realize that there's a rank requirement. I thought the 1 is mentioning level.

  • Custom User Avatar

    I apologize for jumping to conclusions. I see the mistake. I will focus on improving my code and this kata is very interesting and fun in the ways they want you to come up with the information. Just one final question, i have one last error, how would i view the testcase so I can figure out why the error is triggered?

  • Custom User Avatar

    From the description:

    However, if your warrior is at least one rank lower than your enemy, and at least 5 levels lower, your warrior cannot fight against an enemy that strong and must instead return "You've been defeated".

    Yes, the level distance is more than 5 (7 - 1 = 6). However, Level 1 and 7 are the same in terms of rank. Both are at Pushover rank. So, it doesn't meet the criteria for defeat, and returns "intense fight" instead.

  • Custom User Avatar

    Even after the logging, there are some testcases which aren't possible. One of them asks to output the exp and level being 100 and level 1. Which after it says the battle with a level 7 enemy and return intense battle. How would that be possible? I have checked this like 8 times. Either I'm really stupid or the instructions are written in a unclear manner. I am kinda losing patience with this one, it just doesn't seem that the issue is in my code.

  • Custom User Avatar

    Also, quoting B4B from a post below:

    the tests are done in order and depends on the history of the instance that is currently tested. So you need to log the different actions to the console to know what happened before.

  • Loading more items...