Draft

A Lannister always pays his debts

Description
Loading description...
Algorithms
  • Please sign in or sign up to leave a comment.
  • Kacarott Avatar

    Unpublishing due to being a dup (despite this being earlier), as well as old unresolved issues and a long since unactive author.

  • JohanWiltink Avatar

    Won't call it a duplicate of a later kata ( Jun 28, 2014 vs. Jan 7, 2018 ), but this kata has been overtaken by the much better executed Packing your backpack.

  • JohanWiltink Avatar

    Needs more testcases than ONE FIXED TEST.

    DP or memoisation is not even necessary, and generally wrong solutions can pass the tests test.

  • Voile Avatar

    So, another dp problem? ;-)

  • gabbek Avatar

    Needs more test cases, other than that it's a great kata, thank you :)

  • K1ngMX Avatar

    Hey, just a small feedback:

    1. The "500,000" got me really confused first. Maybe remove the ",000" part if you ask me, not all languages do use the "," as a limiter (we have always problem at work with that haha)
    2. You may want to add a big bold "Task" in the Description. Function would be to separate "story" from the actual task.
    3. I think you need more testcases. My solution for example would crash for no people to be paid. Also some more tests would be nice to sort out "corner cases".
  • paragonHex Avatar

    This comment has been hidden.

    • K1ngMX Avatar

      i think you can simple calculate the quotient of (score / debt), sort by that as first criteria, sort by debt as second criteria and use the result as stack, of which you pick items as long as you are below the max debt. At least thats what i did :)

  • Abbe Avatar

    Nice kata.

    It would be nice with a few more test cases. Especially to sort out some corner cases, such as when no debts can be paid.

    I would also advice you to use Test.assertEquals instead of Test.expect. It makes it easier for the developer to see in what way his result differs from the expected one.

    Thanks!

  • wthit56 Avatar

    Passed the example test fixture, but getting the Test Failed: Bolton,Frey,Swyft,Tarth,Tully is not optimal. Looks like the Lannisters are going to war ... message on the first real test. Though I see the reason to hide it, I feel like it would be really helpful to know what the expected result is.

    I've tried many ways of balancing total score with number of houses, but cannot figure it out. Maybe I'm thinking about this the wrong way?

    (My code so far to follow.)

    • wthit56 Avatar

      This comment has been hidden.

    • greghmerrill Avatar

      From your solution, I can see that my problem statement was poor. I have changed "His goal is to reach the highest possible sum of scores for debts paid, thereby reducing the risk of war with as many houses as possible." to simply "His goal is to reach the highest possible sum of scores for debts paid."

      With this in mind, try changing your objective function, and I think you will find the rest of your solution holds good.

    • wthit56 Avatar

      Ah, I see. Now I've passed. Thanks.

      Maybe even clearer would be "His goal is to reach the highest possible sum of scores." As it is, it could be read as "highest sum of scores for the number of debts paid," which would come up with the same problem.

      Thanks for your help!

      Question marked resolved by wthit56 11 years ago
    • greghmerrill Avatar

      Agreed and updated. Thanks again!

    • wthit56 Avatar

      Cool. No problem.

  • jacobb Avatar

    Interesting kata. Not completed yet but I just got the premise. In any case, the only thing that doesn't make sense from the description:

    (in hundreds of thousands of Gold Dragons)

    Technically, the unit seems to be thousands. I.e. XXX,000 instead of X00,000.