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.
Yes. This code returns a boolean value and not a string.
Thank you!
thank you
How I solved the problem...
1, Get something printed out. I tried
print(players)
and variants untilprint(players[1].name)
returned 'b' which looked reasonable.2, I tried
return players[goose].name
, which returned incorrect letters.3, So I modified goose to make it return the correct letters...
return players[goose-1].name
got a few right then returned an out of range error4, so I started printing goose so I could see what values were out of range:
for i in range(30):
print('{} {}'.format(i, players[i].name))
return players[goose-1].name
From the result I found that the players array was 10 characters: abcdcefghz
5, We're getting in to spoiler territory here, but I realised the value needed to loop over the array, so either the array needs to be multiplied so that it's longer than 'goose' characters, or goose needs to be reduced to a value between 0 and 9.
6, I hope you enjoy solving the rest yourself.
This comments speaks to how I'm feeling right now. I'm only a month into learning Ruby part time and have been dismayed at my inability to do these "easy" katas without looking up syntax, or just plain having to look at the solution. Thanks for writing what you did its helped my confidence a little.
The comments here are the kind of bs that makes algorithm study impossible. This kata is very easy if you know "how" to work out problems like this. I wish more people would comment on the foundations to the "how" of a problem rather than just simple stating "oh this is easy, but I don't want to give out hints blah blah blah" nonsense. You can help people become better problem solvers by giving them foundational "how to" without giving spoilers. Sites like this shouldn't be a stump the chump type site. So here is a foundational concept that you should learn so that you can solve problems that involve circular reasoning. It's called modular arithmetic. Google it, practice what you learned, then come back and solve this kata.
perhaps because CW test method is updated from == to === ;-)
I retrained on this kata and copy/pasted this solution. It doesn't work unless I put the boolean values in quotes.