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.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Thanks, just tried again (doing the rollback and rethrowing the error) and it worked fine. Could have sworn I'd already tried something like that...
hi,
you need to do both: rollback AND throw the error. ;)
I'm having an issue (with the Python version, although I this isn't language-specific), regarding the Ko section specifically, and this paragraph:
"Note : If any illegal move is attempted, an error should be thrown and the board rolled back to the previous board before the illegal move. That player will have another chance to place their stone."
So when I first implemented the Ko rule, I just made it throw an error. This passed the first of the 3 tests for this section (the one where it expects an error), but failed the other two because the error stops the program. So I've now switched to catching the error and rolling the board back to before the move. Now the 2nd and 3rd tests are passing fine - but the first one isn't, because the error is being caught and therefore not being seen by the test code. But what are we supposed to do to pass all the tests here? Either I throw (and fail to catch) an error, in which case the rollback doesn't happen and the 2nd and 3rd tests fail, or I catch it (or otherwhile deal with the situation without throwing), in which case the first test fails. How is it possible to pass them all with the same code?
I feel I'm missing something fundamental here, but can't see what...
Thanks! Didn't know about that, it's just what I wanted. (And embarassing to find I failed on only the third test, because my code doesn't correctly deal with successive - signs. But at least now I know what to fix :)
Check out the
Debug.Trace
module in Haskell for quick and dirty debugging.Doing the Haskell version, and having some issues - I passed the 2 sample tests fine, but I'm getting an error in the full tests (still in the "simple tests" section) where it expects -5.0 and I'm getting 3.0. If I've missed an edge case somewhere, so be it and I'll try to fix it, but in real life if your code fails a test you'll at least know what the test case is, right now I'm SOL because my code has worked on every test case I've randomly made up to test it on in GHCi, and I shouldn't have to spend hours figuring out exactly what my code has failed on before even starting to debug it. In other languages of course you can just put a print statement at the top of your function to see what the input is, but in Haskell you can't do that.
I note comments below mentioning that brackets are involved, which I didn't expect from the description. My code will definitely fail if brackets are involved, but that's not what's happening here because I know for a fact my code will throw an error if presenting with a string containing anything other than the 4 operators, digits and spaces.
So, is there any way we can be told what the test case is when a test fails? (I understand why you wouldn't want to list them all up front.)
I'm afraid you're heading towards the wrong path ;-)
The concept around this kata is simple, really, no need to think too deeply about it. The execution, though, is far from trivial ;-)
Sorry, found out at last. The hint is already there ;)
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Thanks for the reply, even though it's even more cryptic than the kata itself :)
I guess you're saying I should go away and hope that at some point in the future it becomes obvious what to do. How strange :) :/
Yes, and no.
I won't say any more than that, otherwise it'd become a big spoiler. Though I know a few people who knows what to do, and is currently struggling on the implementation.
If you have absolutely no idea what to do, my suggestion is to come back after you're finally ready for this. This kata is not for the faint of heart, and IMO people who haven't even figured out the approach is not qualified to claim that it's guesswork.
Am I missing something? We are given no information to enable cracking these passwords by anything other than guesswork. (Or brute force of course - but that's clearly out of the question with 10^32 possible cases.) Is there something missing from the description which would enable us to create some sort of algorithm to do this?
I'm not after a spoiler, just a proper framing of the problem that makes it a programming task rather than a pure guess.
Loading more items...