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.
it's listed under the 'debugging' tag, which means the code is bad and needs to be fixed.
Given that the task is very specific I'd say it is, as it is performant and the code is readable.
If you had to, for example, generate neighbors up to a variable distance
n
received as a parameter of the function, that would be a different story.This comment is hidden because it contains spoiler information about the solution
Well, the kata description already says so: 'Something is wrong with our Warrior class.' — And, indeed, it is.
The initial
Ruby
code is pretty bad, too. (And not only because it doesn't work [correctly or not].)Fixed both issues
I'm pretty sure it's against good practices in all languages, but hey.. you should be able to deal with this kind of code in a software development team since not everyone are experienced