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.
Thanks, I was quite pleased with this :)
Nice. I was trying to get to this, but ended up settling for something a little more verbose.
This comment is hidden because it contains spoiler information about the solution
I'm not sure this deserves top place for Best Practices: it couples the constructor to an instance method. As it's a constructor, the instance is yet to exist, and this sort of flaunts the purpose of OOP in Ruby.
So any survivors know what to put on your gravestone?
It might be that the code inside your loop is not executed, so it returns an empty string. Print the input to see why.
It might be a bug in your solution.
Hard to tell.
I've got a trouble: passed all tests, but click "Attempt" andit says the following:
expected:<[You shot all 0 zombies.]> but was:<[]>
expected:<You shot [all 20 zombies].> but was:<You shot [20 zombies before being eaten: overwhelmed].>
What might it be?
It`s not a solution. Since the goal was to remove vulnerabilities, and with this decision they remained
(If you run out of ammo at the same time as the remaining zombies reach you, return "You shot X zombies before being eaten: overwhelmed.".)
that is in the details, i think in the case mentioned you run out for ammo at the same time zobies reach you, since you need to mutiply range by 2 because zombies move 0.5 meters
why would you neeed to know exactly how you die by the zombie onslaught?
Left in debugging code - bother!
i had simply forgotten about variable hoisting, how embarassing >~< it should be OK now, sorry for the inconvenience
This works: https://www.codewars.com/kata/52250aca906b0c28f80003a1/discuss#615857431274ac0029ce229c
@trashy_incel you don't have to reset everything. You can simply enclose the backward-compatibility with a
try...catch
block to prevent it from producing an error.Loading more items...