Ad
  • Custom User Avatar

    made a small change to the description and accepted

  • Custom User Avatar

    That's a nice Puzzle and really good coding exercise.

    Even though the strategy is simple, it requires A LOT of precision in both thinking and coding.

  • Custom User Avatar

    I think the description would really benefit from clarification that inputs will be easy / random and not adversarial.

    The solutions (at least mine and the top voted one) seem to time out on stupid_input(10), let alone 150.

    def stupid_input(n):
        board = [ ["A"] * n for i in range(n) ]
        word = "A" * (n-1) + "B"
        return board, word
    
  • Custom User Avatar

    That's a very nice test-map.
    I run a 10^6 simulations of a try-random-move-from-options-at-any-point solver and it finds the solution roughly once in 4000 attempts.

    It helped me avoid trying a lot of bad heuristics, and to find a relatively elegant approach to the puzzle.

  • Custom User Avatar

    I don't have an idea for an algorithm that would be significantly faster than a naive solution.

    if you do then go ahead and create a performance version :)

  • Custom User Avatar

    These boards aren't isomorphic:

    • first board has 3h that is the only heart on board
    • the second board has 3c and 8c.

    So the hearts on the first board aren't isomorphic to any suit on the second board

  • Custom User Avatar

    Thanks!

    1. I have fixed the missing suits for the example

    2. This is mentioned in the problem description. I have added the fixed tests for this example (there was one actually - that tested full deck of cards in two different orders, but I added some better examples to the flop section.

  • Custom User Avatar

    Thank you. This comment saved me a lot of time!

  • Custom User Avatar

    Fixed also in the sample tests.

  • Custom User Avatar

    I would love to hear other's opinion before fixing anything as I don't agree with your opinion.

    In the input description is says that :"All coordinates and dimensions are integers."

    So I think that indicates that it could be any integers (positive, negative, large, small) and the is not expected to take in way an advantage of it being some limited range.

  • Custom User Avatar
  • Custom User Avatar

    I have republished the Kata and after fixing the major flaw in the tests all solutions published in so far have been invalidated. Sorry for that.

  • Custom User Avatar

    Marking issue as resolved.

  • Custom User Avatar

    OMG.
    There was a bug in a testing loop.

      if expected is not actual:
          test.assert_equals(actual, expected, f"For point ({x} {y})")
          return
    

    This code was intended to fail only one assertion per test case.
    But the outside loop tested for sameness while the assertion inside tested for equality, so the solution that returned identical rectangle instead of the same rectangle got assertion right, and then early return - performing only one instead of large numbers of checks beating thus beating the tests.

  • Custom User Avatar
    • Removed blank line
    • Flipped expected and actual

    I don't understand the comment about buffer overflow. Can you elaborate?
    (Edit: I understand now, fixed as well)

  • Loading more items...