Ad
  • Custom User Avatar

    The task is misleading: it expects us to find "the best junction", but the actual algorithm expected is greedy, aka to select the maximal entry from the table that are still available until party is full. Any person with slight experience with knapsack related katas will know that greedy algorithm does not guaranteed finding the global maximum.

  • Custom User Avatar

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

  • Custom User Avatar

    Modifying party breaks the random tests.

  • Custom User Avatar

    Hey, you have nothing to apologize for! Your solution isn't the problem, it's the folks who upvote it who are the problem.

  • 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. I agree with you even a FF player may not be able to guess the kata is inspired by FF VIII. Specially because a lot of people hated the junctioning system altogether. I changed the title to something more meaningful.

  • Custom User Avatar

    Re Kata Name: (currently 'The best junctions')

    Is someone familiar with Final fantasy going to be able to work out this is a FF related kata from the title? (I've never played)
    I thought it might have been something about circuts or train tracks.
    Maybe 'Guardian force junctions', or something that makes it a bit more clear, might be better.

  • Custom User Avatar

    This is a nice kata, well done.

    It would be good if the tests could be a bit more helpful with arriving at the solution.

    It's really hard to horizontally compare big hashes, so split the tests up so they compare only a small section of each result at a time.

    Sorting of the output arrays makes it a lot harder to work out where an error occurred.
    It would be good if they could be given in ranked order.

    More 'simple' test cases using fewer elements in GF and CHARACTERS which make the correct answer possible for a human to easily deduce.

    Tests which explicitly test each of the assignment rules.

    All these should happen before the current basic tests.

  • Custom User Avatar

    I modified the framework to do precisely that. I made a fork on github if you want to check it out. Nothing fancy but is what I'm using right now.

    https://github.com/sergio-bobillier/kata-test-framework-ruby

  • Custom User Avatar

    Could you please write some examples of what are the best practices for writing tests that use random values. For example, if you want to check if the solution the user came up with works the same way your solution does when passed random input how do you call your own function? where do you put it? should you just put it in the preload block with some convoluted name?

    Is it okay to use that method for making random tests, I mean: Test.assert_equals(user_funct(rnd), author_func(rnd), "Should work with random input") Is that ok?

  • Custom User Avatar

    true, my bad, new to this

  • Custom User Avatar

    I don't know why people up vote this solution, is horribly inefficient. By using .include? you are making (in the worst scenario) n comparisons in the first iteration, n-1 in the second, n-2 in the third..., meaning, your algorithm is O(n²). It is actually n(n+1)/2, but still pretty inefficient. Sorting the array before the loop could help but still....

  • Custom User Avatar

    When making a kata for Ruby you should follow the Ruby naming conventions, function and variable names are lower case with underscores, not camel case.