Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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.
This comment is hidden because it contains spoiler information about the solution
Modifying
party
breaks the random tests.Hey, you have nothing to apologize for! Your solution isn't the problem, it's the folks who upvote it who are the problem.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
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.
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.
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.
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
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?true, my bad, new to this
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....
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.