Ad
  • Custom User Avatar
  • Custom User Avatar

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

  • Custom User Avatar

    Thank you for your fast response. Sorry that I was not detailed enough.
    With 'important method' I meant all the methods that are required for the kata.
    Extra methods I created myself I am not logging, they are not part of the interface used by the tests.
    I have some difficulty with providing more detailed information because I cannot see the test code itself. Only the output that it gives. But maybe I am unaware of a way to see the testcode.
    I think it is test case 15.

    describe block: "Mutating, adding, add_chaining and valence numbers consistencies"
    it block: "Check all possible mutations and correct behavior of 'add' on the mutated atom"
    There are no names given for the molecules.
    The return values from the formula method with the 3 sequences I described are 'CH4', 'CBr4', and 'H'. As I would expect.

  • Custom User Avatar

    ok, so... In that block, you have a lot of tests done on different molecules
    If you just add a log in the constructor, you'll see that the sequence is actually:

    NEW MOLECULE
    
    "brancher call: [1]"
    "mutate call: [[1, 1, "C"]]"
    "closer call:"
    "formula call:"
    
    "brancher call: [1]"
    "mutate call: [[1, 1, "C"]]"
    "add call: [[1, 1, "Br"], [1, 1, "Br"], [1, 1, "Br"], [1, 1, "Br"]]"
    "closer call:"
    "formula call:"
    
    NEW MOLECULE
    
    "brancher call: [1]"
    "mutate call: [[1, 1, "H"]]"
    "closer call:"
    "formula call:"```
    
    ...
    and so on
    
  • Custom User Avatar

    whenever an important method was called

    They are all important => print everything. Other than saying that, I cannot help you since you don't give any precise info. Like:

    • that test must have a specific name (it block) => ? (edit: oops, it's in there. Let's have a closer look)
    • what's the assertion message?
    • maybe the name of the molecule if any? (that could help me to find out what test you're talking about)

    And you don't even say what's your output with that sequence of calls so.... Man, I cannot read your mind! ;)

  • Custom User Avatar

    I cannot get testcase 27 to pass with Ruby. How can I figure out what test assertion is failing?
    The error message is very generic: 'Testing raw formula with mutation'
    The title of the testcase is: "Check all possible mutations and correct behavior of 'add' on the mutated atom"

    I printed to the log whenever an important method was called, when I try that sequence myself all results are what I would expect.
    The log I created:

    "brancher call: [1]"
    "mutate call: [[1, 1, "C"]]"
    "closer call:"
    "formula call:"

    "brancher call: [1]"
    "mutate call: [[1, 1, "C"]]"
    "add call: [[1, 1, "Br"], [1, 1, "Br"], [1, 1, "Br"], [1, 1, "Br"]]"
    "closer call:"
    "formula call:"

    "brancher call: [1]"
    "mutate call: [[1, 1, "H"]]"
    "closer call:"
    "formula call:"```

  • Custom User Avatar

    "-> nope, that list of attacks leads actually to the numbers 2,2,1,1, boats 1 & 2 sunken, the "3" untouched."

    I do indeed get the numbers 2,2,1,1 and thus 1 boat is sunken, 1 damaged, and 1 untouched. Just like the second sample test case is expecting. I am solving in ruby.

    So this is in contrast to the result that Blind4Basics gave that 2 boats are sunken. I got confused by that comment and somehow overlooked that boat 1 had a length of 3 in the example given.

    Anyway nice kata, I did get confused but that is not necessarily bad practice in my opinion.

  • Custom User Avatar

    I wrote here that my solution returned 11 in your example but 1064 in the medium pyramid but that was not true.
    Actually I changed the test case myself to 1064 and when I fixed my algorithm the testcase failed.
    Rookie mistake.

  • Custom User Avatar

    You are missing a couple of possibilities. For example the grouping 91, 74, 85, 81 gives 331.