Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • 12437011?v=4
  • 14909989?v=3

    Needs random tests, and tests with very big inputs.

  • Profile-pic

    That's right
    But if we'll look at tests again we'll see only strings (and lists of strings) as arguments... so IMO we should consider this tast as "strings"-exercise. And treat the task widly, like with real life tasks. IMO again.

    Thanks for your solution anyway.

  • 5847152?v=3

    the problem statement did not state that the case you described should return true. I think it's a safe assumption that the author only wanted a True to return if there was an exact match in the list, and false if there are only partial matches or no match at all.

  • Profile-pic

    Very clever, but...

    In case of a string='bye' and a list=['bye bye'] it will return False

  • 4226391?v=3

    Ooops, sorry. I got confused between "minor issue"/"major issue" for beta katas (which both lead to the label "issue") and the tag "suggestion". I guess, there's no way for me to change that now, so I mark the issue/suggestion as resolved. Thanks for pointing this out.

  • 6301773?v=2

    So, why do you tag your comment as an "issue" instead of "suggestion"? :D

  • 4226391?v=3

    I suggest to add 'regular expressions' as tag.

  • 4226391?v=3

    @ChristianECooper mentions the same issue. The word "method" in the kata's description should be replaced by "attribute". Then patch your code with one @ant30's suggestions.

  • 4226391?v=3

    I find the topic exciting, but the terminology is notoriously tricky. In particular,

    • What do you mean by a "random number"? Is minimum a random number? You probably want to ask for a random number generator instead.
    • Which distributions do you allow? Judging from the comments/tests, the only requirement seems to be that the endpoints of the intervals are supported. On the other hand, most people probably think of a uniform distribution on the entire interval.
  • 4226391?v=3

    Thanks for providing your rationale about "only good input". I haven't given the issue that much thought. -- I will do now. :-)

    That's a very nice puzzle. As in the case of Nim, the winning condition is already a huge hint towards the correct move. But the connection to this kata is cool. Thanks for pointing this out.

  • Profile-pic

    Your changes are good. My first point was related to "Every positive integer can be written as a sum of Fibonacci numbers." This sets the playing field. It is perfectly fine to say that a solution should validate the input, but I, personnaly, tend to prefer katas that say that we can assume that the input is good. This allows me to cut to the chase and address the essence of the kata. The less frustration, the more upvotes your kata will get. At the end, it's your choice; you don't have to change anything.

    I liked this kata, BTW. Just thought about a way of solving it that is better than my original solution. It reminds me about a game I once read about in one of Martin Gardner's books: Two players take turns removing nuts from a bowl between them. The goal is to remove the last nut. The player who goes first must remove at least one nut, but must leave at least one nut. Thereafter, each player in turn must remove at least one nut, but not more than twice as many as the other player removed last. It turns out that the player who goes first can always win unless the number of nuts to start with is a number in the Fibonacci sequence, in which case the other player has a winning strategy. Martin Gardner leaves it to the reader to figure out the strategy. He simply asks two questions:

    1. What is the correct first move if there are 7 nuts in the bowl?
    2. What is the correct first move if there are 20 nuts in the bowl?

    (7 is not the correct answer to the second question.)

    This could be a nice follow-up to your kata, so please do not reveal any answer to this problem. You'll know when you have the correct answer.

  • 4226391?v=3

    Re 1. (first part) The description also mentions that the function should return None for integers without Zeckendorf representation. So, the test should fail if the function does not return None for input -1.

    Re 1. (second part) I agree that the empty list [] is a reasonable output for input n = 0 and have changed the description (and test cases) accordingly. Thanks for the suggestion.

    Re 2. I completely agree. Actually, 6kyu is the rank I suggested and that's the only assessment that I see in the stats.

  • 2478559?
  • Profile-pic
    1. The description mentions Zeckendorf representation of positive integers, so one should be able to assume that n is positive. Yet, tests fail is the function does not return None for non-positive n. Also, the natural result for the case when n == 0 is [], since sum([]) == 0
    2. The kata is way too simple for a 4kyu. I suggest 6kyu or higher.
  • Loading more items...