Ad
  • Default User Avatar

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

  • Default User Avatar

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

  • Custom User Avatar

    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...

  • Custom User Avatar

    hi,

    you need to do both: rollback AND throw the error. ;)

  • Custom User Avatar

    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...

  • Custom User Avatar

    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 :)

  • Custom User Avatar

    Check out the Debug.Trace module in Haskell for quick and dirty debugging.

  • Custom User Avatar

    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.)

  • Custom User Avatar

    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 ;-)

  • Custom User Avatar

    Sorry, found out at last. The hint is already there ;)

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    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 :) :/

  • Custom User Avatar

    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.

  • Custom User Avatar

    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...