Beta

Shelve your trophies

Description
Loading description...
Mathematics
Puzzles
  • Please sign in or sign up to leave a comment.
  • saudiGuy Avatar

    not enough random tests.

  • Blind4Basics Avatar

    your solution is incorrect:

    shelve_trophies(2, 6, ['5.1.4', '4.#.1', '1.x.2', '1.1.3', '0.1.2', '4.1.5', '5.1.2'])
    expected 2 but was 1
    
    • 4.#.1 => 4 is on shelf 0
    • 4.1.5 or 5.1.4 => 5 is on 1
    • 5.1.2 => 2 is on 0
    • 0.1.2 => 0 is on 1
    • 1.x.2 => 1 is on 1
    • 1.1.3 => 3 is on 0

    all trophies positions are perfectly determined and there is only one solution.

  • Blind4Basics Avatar

    your solution isn't robust enough:

    on these arguments: 5, 4, ['3.#.4', '3.1.0', '2.#.0', '1.x.2', '3.x.2', '1.#.3', '1.1.2'] 
    
    STDERR
    Traceback (most recent call last):
      File "main.py", line 95, in <module>
        test.assert_equals(n_shelves, answer(shelves, trophies, rules))
      File "main.py", line 52, in answer
        [1])]
    IndexError: list index out of range
    
    • themanofcat Avatar

      Peculiar. I had gotten this error on the first run, then proceeded to run it again quite a few times until I landed on it again, so I could see the circumstances; but it never came up. I'll look into it, but I'm very confused as to why it happens.

  • Blind4Basics Avatar

    Hi,

    Sounds interesting. But you forgot to give some information:

    • trophies seems to actually be 0-indexed.
    • what about the shelves? I guess it's the same?
    • should all shelves be used at least once or not?
    • max number of trophies per shelf?

    Aside of that:

    • you need more fixed tests (tests that are actually testing specific edge cases)
    • you need more random tests (and call them that way, not just "real tests". Those tests clearly aren't reality related... ;) )
    • themanofcat Avatar

      About the indexing: yes, both are 0-indexed, that was meant to be a convenience but it definitely requires a note — I'll add that to the description No, not all shelves need be used and no shelf has a maximum trophy limit (although that might be an interesting addition); these will also be added

      About the tests, I definitely ought to, absolutely. This is my first time making a kata and was sort of a test to see if I could (this is actually a variation of a question on an LSAT that my friends and I were doing math on for some reason), so I greatly appreciate the criticism.

    • Blind4Basics Avatar

      'kay I figured that on my own, but thx for the answer.

      Note that your solution is very slow. So you need to improve it otherwise you won't be able to push the number of tests. Note also that some maths could be used to reduce drastically the amount of computations in some cases. That might be interesting to add that. Maybe it could be worth of unpublishing the kata so that you can polish it a bit?

      Mine being without optimisation (apart from the rules I check or not), I get things like this:

      mine
      Completed in 214.00ms
      his
      Completed in 3034.33ms
      mine
      Completed in 0.18ms
      his
      Completed in 0.47ms
      mine
      Completed in 0.78ms
      his
      Completed in 1.45ms
      mine
      Completed in 0.04ms
      his
      Completed in 0.20ms