Ad
  • Custom User Avatar

    The details define the boundaries as "Given a number as a parameter (between 2 and 30)", while in reality the tests contain the values up to 100.

  • Custom User Avatar

    Yes, it passes the "Remove empty branches, after unlocking" section.
    Though, the solution is submitted now, I was experiencing random failures of 1-2 random tests and that's where I couldn't spot, what the issue is :-|

  • Custom User Avatar

    To further clarify, I'm doing this kata using Ruby, the solution passes all the basic tests, around 20% of the random tests, and just one (Throw an EmptyMolecule exception when no branches are left after unlocking) test out of the "Behaviors related to the "unlock" method" section.
    Another question: should the branches be renumbered as well and if yes - should this happen during the "unlock" or upon mutation of the branch first element?

    Update: It seems that I got it, all the Hydrogens suppose to be removed regardless whether they are added on "closer" or mutated, so now my solution passes all the non-random tests, however it passes only 20 to 30% of random tests, hence the question - how do I properly debug that given that the outcome of the tests is truncated and the visible part seems to be equal?

    expected: ["Atom(O.1: C13,Cl16)", "Atom(O.2: C3)", "Atom(C.3: C4,C18,O2)", "Atom(C.4: C3,C5)", "Atom(C.5: C4,C6....23: C22,C24)", "Atom(C.24: C23,C25)", "Atom(C.25: C24,C26)", "Atom(C.26: C25)", "Atom(Mg.27: C19)"]
         got: ["Atom(O.1: C13,Cl16)", "Atom(O.2: C3)", "Atom(C.3: C4,C18,O2)", "Atom(C.4: C3,C5)", "Atom(C.5: C4,C6....23: C22,C24)", "Atom(C.24: C23,C25)", "Atom(C.25: C24,C26)", "Atom(C.26: C25)", "Atom(Mg.27: C19)"]
    

    More specific question is about the following sequence of events:

    molecule = Molecule.new
    molecule.brancher(7,5)
    molecule.mutate([3, 2, "P"],[5, 1, "Br"],[7, 1, "S"])
    molecule.bounder([3, 2, 2, 2],[6, 1, 2, 2],[1, 2, 2, 2],[1, 1, 4, 2])
    molecule.closer()
    

    My code throws an InvalidBond exception on the attempt to mutate to Br and therefore ignores mutation to S.
    As an outcome of these events, my code returns formula as C11H22P and molecule.atoms as

    [Atom(C.1: C2,H,H,H),
     Atom(C.2: C1,C3,H,H),
     Atom(C.3: C2,C4,H,H),
     Atom(C.4: C3,C5,H,H),
     Atom(C.5: C4,C6,H,H),
     Atom(C.6: C5,C7,C9,H),
     Atom(C.7: C6,H,H,H),
     Atom(C.8: C9,C9,H,H),
     Atom(C.9: C6,C8,P10,P10),
     Atom(P.10: C9,C9,C11),
     Atom(C.11: C12,P10,H,H),
     Atom(C.12: C11,H,H,H),
     Atom(H.13: C1),
     Atom(H.14: C1),
     Atom(H.15: C1),
     Atom(H.16: C2),
     Atom(H.17: C2),
     Atom(H.18: C3),
     Atom(H.19: C3),
     Atom(H.20: C4),
     Atom(H.21: C4),
     Atom(H.22: C5),
     Atom(H.23: C5),
     Atom(H.24: C6),
     Atom(H.25: C7),
     Atom(H.26: C7),
     Atom(H.27: C7),
     Atom(H.28: C8),
     Atom(H.29: C8),
     Atom(H.30: C11),
     Atom(H.31: C11),
     Atom(H.32: C12),
     Atom(H.33: C12),
     Atom(H.34: C12)] 
    

    which is considered invalid, but I'm wondering what is a valid result, so that I could try to debug my code.

    Okay, I found an issue in my code where I didn't remove the improperly created bond on one side when it failed on the other side, but now I have the problem that my solution fails randomly for 1-2 of random tests, though may pass if I try "attempt" several times.

  • Custom User Avatar

    @Blind4Basics, I'm struggling with the unlock method - it says "Hydrogens should be removed, as well as any empty branch you might encounter during the process.", but it doesn't specify if this applies only to the Hydrogens that were added during the closer method or any Hydrogens including the ones that were added via add, add_chaining and mutate.
    The tests aren't explicit enough to understand what exactly is wrong with the molecule in the 'Behaviors related to the "unlock" method' section.
    I've tried different approaches (deleting all Hydrogens vs deleting only the ones that were added by closer), but the tests starting from All hydrogens should have been removed after closing/unlocking and carbons ids modified accordingly fail anyway.
    Any hint/clarification on the unlock method expected behavior?

  • Custom User Avatar

    @Erhu, proving that sudoku has multiple solution may be done in different ways and one of them is not that time-consuming.
    Think of what it means that there are several solutions in terms of the resulting elements positions & values.

  • Custom User Avatar

    AFAIU, if you have a sudoku with zero empty (zeroed) cells, which doesn't require to be solved, it should be marked as invalid.

  • Custom User Avatar

    I'd say that there's not enough tests for a larger inputs (e.g. at least 10^6+ elements).

  • Custom User Avatar
  • Custom User Avatar

    You're right, 3*9 = 27, £ == -1, so 27+(-1) == 26

  • Custom User Avatar

    The description or basic tests are lacking the examples of the sentences, because initially the user may think that "vs" is the only type of thing to appear between the team names.

  • Custom User Avatar
  • Custom User Avatar

    Ruby version of a Kata fails when Attempting to submit a solution with:

    main.rb:14:in `import': undefined method `unpack' for nil:NilClass (NoMethodError)
    	from main.rb:60:in `block (2 levels) in <main>'
    	from main.rb:59:in `times'
    	from main.rb:59:in `block in <main>'
    	from /runner/frameworks/ruby/cw-2.rb:55:in `block in describe'
    	from /runner/frameworks/ruby/cw-2.rb:46:in `measure'
    	from /runner/frameworks/ruby/cw-2.rb:51:in `describe'
    	from /runner/frameworks/ruby/cw-2.rb:202:in `describe'
    	from main.rb:55:in `<main>'
    

    So, apparently, it looks like it's a solution issue rather than the Kata one, but this isn't obviously clear from the error messages and I believe it worth to improve the tests to avoid crashing like this in case of "inappropriate" solution.

  • Custom User Avatar

    There's an issue with random tests on Ruby.
    It shows the error message when trying to submit.

    ./lib/preloaded.rb:2:in `isomorph_sol': undefined method `to_set' for #<Enumerator: "SRQKRCTLDGPRKORTFFVUDDWYREETJNGLFHCIGFLRITILNDR":each_char>
    Did you mean?  to_s (NoMethodError)
    

    Adding "require 'set'" to the solution solves the problem, but I am not using 'set' in my solution, so it seems that the reference solution simply forces me to require an unnecessary module.

  • Custom User Avatar

    I believe that's because 493039 == 79**3, so it shouldn't be an issue.

  • Custom User Avatar

    Nice kata, but it lacks the tests with larger values, at least 20 dice of 20-sides.