Ad
  • Custom User Avatar

    Sorry, I couldn't think of better names at the time. 😅

  • Custom User Avatar

    one tiny bug: rand(0...10) that's inclusive, so that's 11 outcomes where in python it's 10. I don't actually care and will approve that, would be nice if it's the same though. same with 0...5 of course

    It's not inclusive.

    I added the other cases.

  • Custom User Avatar

    You're right, and thanks for the feedback. I made them distinct and followed the logic of Python snippet you provided. Check it out!

  • Custom User Avatar

    I think you're seeing errors from different tests. The UI unfortunately doesn't make this very clear. One thing you can try to do is use something like console.log(a, b, margin) in your function to see what exactly is being tested.

  • Custom User Avatar

    If margin is not provided (undefined), then it should be no different than passing in 0 for margin.

    Essentially, you need to make sure that closeCompare(a, b) === closeCompare(a, b, 0).

  • Custom User Avatar

    Thanks, approved!

  • Custom User Avatar

    Thanks, approved!

  • Custom User Avatar

    Thanks, approved!

  • Custom User Avatar

    This same kata was mentioned earlier in a different comment.

    I'll repeat what I mentioned there:

    Although I may be biased, I would still argue that this kata is considerably different given the rules and data structure. E.g. there's an arbitrarily large range of floors to handle, basements are allowed, the elevator stops in less places, etc. I would imagine solutions would need to be quite different.

  • Custom User Avatar

    Sounds good, added!

  • Custom User Avatar

    Okay, first of all, I apologize. The Python "small building" tests were supposed to span under 15 different floors. I fixed that now so hopefully the issue you're having is easier to see.

    Anyway, I added only 1 of your examples to the Python tests, plus another one that I think illustrates the problem you're having. I.e. this one:

    puzzle = [{'from': 5, 'to': 4},  # 1st
              {'from': 5, 'to': 3},  # 2nd
              {'from': 3, 'to': 4},  # 3rd
              {'from': 0, 'to': 2},  # 5th
              {'from': 3, 'to': -4}, # 4th
              {'from': 1, 'to': 2}]  # 6th
    solution = [5, 4, 3, 4, 3, -4, 0, 1, 2]
    tester(5, puzzle, solution)
    

    Feel free to let me know if that's enough!

  • Custom User Avatar

    I added more test cases. I even had to optimize some of my solutions further. I think it's in a good place now.

  • Custom User Avatar

    Good suggestion! I added a bunch more "small building" tests. Some languages run the tests in random order, and I may have to change the labeling in some cases to fix it unfortunately.

  • Custom User Avatar

    Okay, I updated the rules to be clearer (hopefully)!

  • Custom User Avatar

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

  • Loading more items...