Draft

Late delivery

4 of 5artiekra
Description
Loading description...
Puzzles
  • Please sign in or sign up to leave a comment.
  • Voile Avatar

    This is just a glorified knapsack problem with additional flair wrapping the core task. There are already many published knapsack katas.

  • Blind4Basics Avatar

    Hi,

    Your output for the distribution tests should contain 3 strings ( your's contains 1 ). Read the description for more information.

    • The above is an useless message and is very annoying to debug the solution => just show the actual and expected strings
    • the sample tests should cover all cases (the sampel test that was asked for in the last message od this page still isn't there
    • missing typical number of tests
    • not enough fixed tests (since, they are the same as the sample tests)
    • a first batch of small random tests (with reasonnable values) might be of use.

    Cheers

  • JohanWiltink Avatar

    the indexing of the packages starts at 1, not at 0

    Please use normal 0-based indexing. Why waste a perfectly good number? Just to try and frustrate your solvers? It adds nothing to the task, and it does detract.

  • JohanWiltink Avatar

    let's name the drivers Jake and Alan accordingly

    let's name them Jake and Elwood

    apparently they've fallen on hard times :P

  • russfre Avatar

    This comment has been hidden.

  • mauro-1 Avatar

    This comment has been hidden.

  • mauro-1 Avatar
    • Tests should explicitly import test framework and user solution:

      import codewars_test as test
      from solution import calculate_delivery
      
    • Missing test.describe;

    • Tests should fail without throwing exceptions when the actual result isn't a string with the right format;

    • There should be some "small" random test (5-15 packages, weight < 100);

    • There should be at least one "distribution" test in sample and fixed tests;

    • artiekra Avatar

      Fixed it, update will be published soon ( problems 1, 2 and 3 ). Problem №5 has it's own "thread", and I will mark that issue as resolved instead.

      Issue marked resolved by artiekra 2 years ago
  • dfhwze Avatar

    Sample and fixed tests should be added for each possible branch you describe in the description.

    • test missing for the most complex case: share between both Jake and Alan
    • artiekra Avatar

      Thanks! I tried to do this, but encountered some problems with it... How can I put this tests in the preloaded code? And if it's not the best solution, than would it be ok to just put the tests on distribution in the example test cases themselves?

    • dfhwze Avatar

      Why you want to put a test in preloaded code? Just add a test case after the existing tests.

    • artiekra Avatar

      This comment has been hidden.

    • artiekra Avatar

      Please, respond to the message above. I really don't want to close this issue, but that is the only thing that I can do, because there is no way of implementing distribution tests into example test cases without putting testing code right there or in preloaded code. As I already said, it will be very hard and unnecesary to list all the possible solutions.

    • dfhwze Avatar

      You don't need to list all possibilities. You need to implement a verification method to check on the fly whether the user solution is correct.

    • dfhwze Avatar

      close this issue, we'll see later how to handle this

    • artiekra Avatar
      Issue marked resolved by artiekra 2 years ago
  • benjaminzwhite Avatar

    It's a nice kata, but I wonder if it's worth redesigning to make the output format a bit simpler/clearer:

    1. Does the 1-indexing really add anything (I understand it may come from source Olympiad question, but are they using Fortran/Julia/APL for their questions O_o ? For Python kata why not just have it 0 indexed ?).

    2. Or maybe why not ask to return the package values themselves? Looking at your solution checker it seems that would work also?

    • artiekra Avatar
      1. Returning the package number can be harder than just the weight of the package, and it really changes the solution; not just that, it makes testing much harder, because I can't just check, if all values are unique ( some weights might repeat ). It seems like it will add more problems to the testing, which is already really complex.
      2. As you probably saw from a kata itself, all of the outputs are really human-readable. I guess I can remake it for indexing to start with 0, but for me it seems kind-of wrong or somehing. I would like to hear other's opinions on that one.
    • benjaminzwhite Avatar

      Fair enough, that makes sense - thanks for replying!

      My query was from point-of-view of 6-7 kyu Users - when I review Beta kata I just try to anticipate the most likely User's problems, while there is still time to make some modifications (many users don't always read descriptions fully!).

      But re-reading tests, I just noticed you have a custom error message in the Tests with Remember that indexing of packages starts at 1! so that's a nice idea.

      In worst case, if you have many Questions in Discourse about 1-indexing, you can always add a reminder in the Solution Setup itself also.

  • dfhwze Avatar

    Is this an error in test cases?

    jake = list(map(int, parsed_output[0]))
    IndexError: list index out of range
    

    returning:

    'They need to work together! Jake 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 175 178, Alan 174 176 177.')
    
    • artiekra Avatar

      Description says

      ... beetwen both of them, return 3 strings ( you can use \n, like this String1\nString2 ). First string is always ...

      And by that I meant that you MUST use \n. Maybe that wasn't so clear, so I will change this up a little bit, and probably change the tests so there is no exception.

      EDIT: I changed it ;)

      Question marked resolved by artiekra 2 years ago
    • dfhwze Avatar

      You should definately add a sample test for such a case.