Ad
  • Custom User Avatar

    I fixed it in a new fork, though maintaining the right order Expect(expected).To(Equal(actual)) in the tests (otherwise the message seems contradictory, at least it's how all katas tests are set).

  • Custom User Avatar

    Each race has a certain worth when battling against others.

    That should cover the common error, but if a test was added in the sample tests it would be fine by me. Or adding this example to the description:

         Good                                       Evil
    
     0 0 0 0 0 1                   /            0 0 0 1 1 1 0
        Wizard                     /       Goblin + Uruk Hai + Troll
          10                       /         2    +  3       +   5
          10                       /               10                           
    

    10 = 10 therefore it is a draw

  • Custom User Avatar

    You first minimize i then minimize j. There is an order to the operation involved. Otherwise why are they listed in an ordered list?

    Also, Have you looked at the dozens of comments from other people is an invalid argument because there are always clueless people who raise bogus issues on even 8kyus that has no problems because they didn't bother reading the descriptions and blame everything as someone else's fault. In fact I can pull several extreme examples immediately:

    https://www.codewars.com/kata/sum-of-digits-slash-digital-root/discuss
    https://www.codewars.com/kata/persistent-bugger/discuss
    https://www.codewars.com/kata/good-vs-evil/discuss

    I don't have problems because I do look at descriptions and when I get failed tests, I review my code and see why I'm wrong (emphasis I, I don't blame the kata for anything unless it's proven to be the kata's fault). If you're blaming the kata and the kata author for everything regardless of their correctness, you're causing more trouble for its worth.

    (Also, no, requiring i to be smallest is not stupid at all because that's the only way to guaranteed the uniqueness of the solution. If you're thinking otherwise you're stupid. Please reflect more on yourself.)

  • Custom User Avatar

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

  • Default User Avatar

    Yes, you have a point. If this Kata had a performance version a different approach would be required.

  • Default User Avatar

    As I was saying, many lines aren't used:

    • debug info
    • two unused variables at the top
    • code repetition

    The rest is interesting, otherwise I would not have forked your solution but published a new one.

    I also did change the logic a bit. adjectives and nouns are sets: by iterating on them with a nested loop, you have actually lost their main advantage, a constant time look up operation.
    At worst, you read all the sets in order to check if split_word is inside whereas you can just use in operator.
    In addition, using replace to get rid of suffix can be wrong if a word begins with this suffix.
    Also note that slicing is faster that replacing end of a word.

  • Custom User Avatar

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