Ad
  • Default User Avatar

    Every prime number except 2 and 3 is of the form 6k+1 or 6k-1 , this property can be used to avoid unnecessary looping:)

  • Custom User Avatar

    @Hadron, that is a good summary of the problem. Can you suggest a more helpful wording for the error message?

  • Custom User Avatar

    This looks like a case of the instructions not being followed to the letter.

    'If one or more of the opponents pieces are sandwiched by the piece just played and another of the current player's colour...'

    Emphasis on 'just played'.

    In the play sequence that both MariusAFT and jkranking refer to, neither of the adjacent pieces are 'just played'.

    Instead, white has cleverly inserted his piece between two of his opponents previously played pieces, rendering his piece safe.

    It caught me out too. If I'm right about the reason then this specific error message might need revising as it's misleading.
    Good kata, however.

  • Custom User Avatar

    Hi @hovacink. I've just checked the test in the four languages and are working well. Python may experiment being timed out once in ten attempts. For the other versions the runtime is under 3500 ms. Hope that you can solve it.

  • Custom User Avatar

    same problem here ;/ only the first 2 tests get executed

  • Custom User Avatar

    Note that the flipping stops when the first piece of the player's colour is reached.

    Does that help?

    Could you explain the algorithm you are using?

  • Default User Avatar

    I'm getting the same error. Non-adjacent piece should NOT flip - Expected: ".O.O*.", instead got: ".O.****."

    Is this correct? I don't understand why the answer is not ".O.****" instead of ".O.O*"

    The instructions say that move should flip anytime it is sandwiched by another move.

    Thanks

  • Custom User Avatar

    Consider what happens to your code if you get an empty list.

  • Custom User Avatar

    * is a special markdown character that causes italics or bold so you to surround it with backticks.
    '.O.****.' should equal '.O.*O**.'

    What does the board look like before you place the piece at index 6?

  • Custom User Avatar

    Could you explain why it makes sense to flip the O at index 4?

  • Custom User Avatar

    Due to some changes on the servers, the javascript version is having problems now. Seven people passed before without problems. I checked the python and ruby version and are working fine.

    Let's see if I can make some changes to speed it up.

  • Custom User Avatar

    Me too have the same problm.Can anybody optimize it

  • Custom User Avatar

    @MariusAFT,

    The return value is supposed to be a string -> "None"

    >>> type(None)    # not this None
    <class 'NoneType'>
    >>> type('None')  # this "None"
    <class 'str'>