Ad
  • Custom User Avatar

    Well, this is odd - I just ran the algorithm the kata uses with those parameters and your answer is correct. I have no idea what's going on.

  • Default User Avatar

    As far as I can see, my solutions fails on some random tests cases when it shouldn't (more or less 10 each time)...

    I tried to see what the result should be for some of these cases "by hand" and found back my solutions. So either I did not understand something, but managed to pass the normal tests anyway, or the random tests are wrong (but this would be surprising if some people succeeded...).

    An example :

    rules = [[1, 1, 0], [1, 1, 1], [0, 0, 0]]
    initial = [1, 1, 1, 0, 0, 1, 1, 0, 0, 0]
    generations = 10

    error message :
    [0, 1, 1, 0, 0, 0, 1, 1, 1, 0] should equal [0, 0, 1, 1, 1, 0, 0, 1, 1, 0]

    And how I find back my result (and not the one in the error message...) :
    1 1 1 0 0 1 1 0 0 0
    0 1 1 0 0 0 1 0 1 0 (1)
    0 0 1 0 1 0 0 0 0 0 (2)
    1 0 0 0 0 0 1 1 1 1 (3)
    1 0 1 1 1 0 0 1 1 1 (4)
    1 0 0 1 1 0 0 0 1 1 (5)
    1 0 0 0 1 0 1 0 0 1 (6)
    1 0 1 0 0 0 0 0 0 0 (7)
    0 0 0 0 1 1 1 1 1 0 (8)
    1 1 1 0 0 1 1 1 1 0 (9)
    0 1 1 0 0 0 1 1 1 0 (10)

    I'd be very grateful if someone could explain me what is wrong in the way I am doing this !

  • Custom User Avatar

    Difficulty is not a suggestion.

  • Default User Avatar

    Your solution is excellent. In principle, it can be used to solve a generalized problem with other win conditions.

  • Default User Avatar

    I'm quite ashamed of myself when I see how simple the maths were...

    But in brings some variation in this kata were all other solutions are very similar XD

  • Default User Avatar

    A kata about debugging is in itself a good idea, however I think this was maybe a bit too easy... One doesn't even need to understand what the code is doing, this is a really basic syntax problem.

    Debugging is something any programmer will experience, and it is important to know how to do it, but for the kata to be interesting the error(s) should at least require us to understand what the code is trying to do (which is not the case here).