Ad
  • Custom User Avatar

    This one is actually having lowest complexity compared to all better rated solutions!

  • Custom User Avatar

    Of several tested, this was fastest.

  • Default User Avatar
  • Custom User Avatar

    Really nice kata and concise, step-by-step description. Thank you!

  • Custom User Avatar

    Shouldn't this kata also enforce performance requirement similar to Squared Spiral#1?

  • Custom User Avatar

    Missing edge cases for horizontal and vertical line segments colinear with one of the rectangular sides with different intersection patterns:

    test.assert_equals(line_crossing_area((0, 0, 20, 20), ((-100, 10), (100, 10))), True)
    test.assert_equals(line_crossing_area((0, 0, 20, 20), ((10, -100), (10, 100))), True)
    test.assert_equals(line_crossing_area((0, 0, 20, 20), ((-100, 10), (0, 10))), True)
    test.assert_equals(line_crossing_area((0, 0, 20, 20), ((10, -100), (10, 0))), True)
    test.assert_equals(line_crossing_area((0, 0, 20, 20), ((0, 10), (100, 10))), True)
    test.assert_equals(line_crossing_area((0, 0, 20, 20), ((10, 0), (10, 100))), True)
    test.assert_equals(line_crossing_area((0, 0, 20, 20), ((50, 10), (100, 10))), False)
    test.assert_equals(line_crossing_area((0, 0, 20, 20), ((10, 50), (10, 100))), False)
    

    Also missing edge cases where line has zero width:

    test.assert_equals(line_crossing_area((0, 0, 20, 20), ((0, 0), (0, 0))), True)
    test.assert_equals(line_crossing_area((0, 0, 20, 20), ((10, 10), (10, 10))), True)
    test.assert_equals(line_crossing_area((0, 0, 20, 20), ((0, 10), (0, 10))), True)
    test.assert_equals(line_crossing_area((0, 0, 20, 20), ((10, 0), (10, 0))), True)
    test.assert_equals(line_crossing_area((0, 0, 20, 20), ((20, 20), (20, 20))), False)
    

    And edge cases with 0 rectangle area (technically 0 width only and 0 height only should be tested too, but I didn't bother to write tests for those):

    test.assert_equals(line_crossing_area((0, 0, 0, 0), ((0, 0), (0, 0))), True)
    test.assert_equals(line_crossing_area((0, 0, 0, 0), ((10, 10), (10, 10))), False)
    test.assert_equals(line_crossing_area((0, 0, 0, 0), ((0, -10), (0, 10))), True)
    test.assert_equals(line_crossing_area((0, 0, 0, 0), ((-10, 0), (10, 0))), True)
    test.assert_equals(line_crossing_area((0, 0, 0, 0), ((10, -10), (-10, 10))), True)
    test.assert_equals(line_crossing_area((0, 0, 0, 0), ((-10, -10), (10, 10))), True)
    

    The author solution can correctly handle all these test cases without failing or throwing exceptions (due to division by 0). Every submission besides one fails against some of them.

  • Default User Avatar

    I tried to apply recursion in my solution for generate the coordinates, but it was difficult to make the solution small.

  • Custom User Avatar

    Was quite a good kata !
    IMHO not challenging enough in terms of performance..
    My sol, not optimized at all, runs in 2,5 secs ??

    Funny detail: 'UP' is y+=1 (quite strange for me, I used to be a "graphic" guy thus 'UP' means ... y-=1 to me...:-))
    For the maths: is there a closed form ?

  • Default User Avatar

    I'm getting this error: 8WXSY7WGXBM122383 should be invalid! expected:true but was:false
    When I run the code with my IDE I get true.

  • Default User Avatar

    Liked this kata, it helped me reaqaint myself with array and arrow functions

  • Default User Avatar

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

  • Default User Avatar

    Thanks for creating a great kata. Quite tough for a 6, but very enjoyable!

  • Custom User Avatar

    I enjoyed this kata, thanks for putting it together.

  • Custom User Avatar

    javaScript .
    thanks.

    I have already found a solution.

  • Custom User Avatar

    In which language?

  • Loading more items...