Ad
  • Custom User Avatar

    Yes, because my solution was just brute-forcing all the angles. It wasn't constant time, and there are always gaps between the angles tried.

  • Custom User Avatar

    While the issue is valid, your solution seems to have some rounding problems, e.g.

    Assert.IsTrue(Shape.TriangleFitsInSquare(820147.4907294856, 756913.4956441872, 615778.0534322486, 722099.4062361511));
    
  • Custom User Avatar

    Reference solution used for random tests is clearly incorrect:

    TriangleFitsInSquare(415339.9863145371, 459659.20499247574, 666405.0066220658, 479755.37244198116)
    
    Test Failed
      Expected: False
      But was:  True
    

    At a = 415339.9863145371 pointing 88 degrees clockwise and b = 459659.20499247574 pointing ~172.43 degrees counter-clockwise, the third side equals c = 666405.0066220658 and the bounding square is around 471795.42395730014, smaller than 479755.37244198116.

  • Custom User Avatar

    You can assume that the sides represent always a valid triangle.

    One fixed test case is TriangleFitsInSquare(120.378, 340.873, 220.494, 600.698), which violates the triangle equality (and expects true for some reasons).

    There are also cases like TriangleFitsInSquare(101.419, 184.952, 83.533, 454.56) which is a triangle with 0 area.

  • Default User Avatar

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

  • Custom User Avatar

    Yes, was easy to see - bad world;-)... So thanks and well done:-)!

  • Default User Avatar

    Hi, thank you. Added them. I tried to be lazy with negative test cases, and immediately someone noticed it :D Designing my first kata, as you see.

  • Custom User Avatar

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