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.
Can't believe I missed this! Nice.
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:
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.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.
I agree with that. I have no idea why I wrote this solution.
Also it seems that some important tests are missing.
so if the arr is {1, 1, 1} the answer will go wrong
Not if the number of items is less than 2.
Is this any different between (return #arr - 2) ?
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.
This comment is hidden because it contains spoiler information about the solution
Wow, this was hard. :)
CS updated. I didn't touch the random part, but, increasing the number of tests, it seems all is still fine, so...
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.
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.
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.
Yeah, I see that it would break most solutions. So, as you think.
Warning, you forgot to change the error message (python at least):
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...