Ad
  • Custom User Avatar

    Can't believe I missed this! Nice.

  • Custom User Avatar

    Agree, requirements are not 100% clear especially when reading some of the comments here. I actually just finished this kata and based on the test results, it's definitely the case that only order of operations is considered, not parentheses. For example:

    t & f ^ t
    (t & f) ^ t
    

    Assuming & has equal or higher precedence than ^, the two expressions above have the same exact order of operations, and so should only be counted once.

  • Custom User Avatar

    Ignore the case that does not have inner parenthesis

    Why?

    What are the rules for how parenthesis are placed?
    I think many poeple will skip this Kata because the rules seem unclear, and solving will require guessing and checking against the test cases to understand the problem.

    EDIT:
    "(t ^ f & t)" is the same as "((t ^ f) & t)"
    If each expression is re-written in a notation without parenthesis (using order of operations), the expressions are identical, and count as one.

    KenKamau is intentionally being vague about the rules.

  • Custom User Avatar

    I agree with that. I have no idea why I wrote this solution.
    Also it seems that some important tests are missing.

  • Custom User Avatar

    so if the arr is {1, 1, 1} the answer will go wrong

  • Custom User Avatar

    Not if the number of items is less than 2.

  • Custom User Avatar

    Is this any different between (return #arr - 2) ?

  • Custom User Avatar

    Nice challange, however I feel there were too much hints in the comments. :) At least I was able to solve in an hour with your answer.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Wow, this was hard. :)

  • Custom User Avatar

    CS updated. I didn't touch the random part, but, increasing the number of tests, it seems all is still fine, so...

  • Custom User Avatar

    Reset seems to be working fine in Python. I'm not sure about updating the description? The second item under Invalid handicap usage states that you can't place handicap stones down after they have already been placed (I understand if you didn't see it ;p).

    Thanks for updating the coffeescript translation! Does the random testing for it need updating? It should very similar to the JS version in terms of functionality.

  • Custom User Avatar

    mmmm... that's weird. In python, your code has to throw an error for the second call, so the number of handicap stones doesn't matter. You do it in JS, right?

    EDIT: java up to date. I raised the number of random tests from 125 to 400, considering the python version is far more demanding.

    EDIT²: I tried to update the coffeescript version. No problem for the fixed part, then I looked at the random tests... :/ I saw weird things in there... That made me look closer to your python version (random part): are you sure that your reset method is correct? Seems it's rolling back one step instead of actually resetting the game.

  • Custom User Avatar

    My current implementation also not supports multiple calls. It was in my mind to do it, but forgot. Then I realized that the tests are passing. :) I think at least the case when you call the handicapStones function again, but with lower value than before should be tested, as it will end with a wrong setup.

    game.handicapStones(5);
    game.handicapStones(3); // -> my implementation leaves 5 stones on the board
    

    Yeah, I see that it would break most solutions. So, as you think.

  • Custom User Avatar

    Warning, you forgot to change the error message (python at least):

     Placing handicap stones twice in a row is not valid
       Expected an error thrown with too many handicap stones
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    

    And you forgot to update the description about that, it seems (couldn't find it, I mean (the description has become quite long, after my completion of the kata! x) )

  • Loading more items...