Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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.
While the issue is valid, your solution seems to have some rounding problems, e.g.
Reference solution used for random tests is clearly incorrect:
At
a = 415339.9863145371
pointing 88 degrees clockwise andb = 459659.20499247574
pointing ~172.43 degrees counter-clockwise, the third side equalsc = 666405.0066220658
and the bounding square is around471795.42395730014
, smaller than479755.37244198116
.One fixed test case is
TriangleFitsInSquare(120.378, 340.873, 220.494, 600.698)
, which violates the triangle equality (and expectstrue
for some reasons).There are also cases like
TriangleFitsInSquare(101.419, 184.952, 83.533, 454.56)
which is a triangle with 0 area.This comment is hidden because it contains spoiler information about the solution
Yes, was easy to see - bad world;-)... So thanks and well done:-)!
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.
This comment is hidden because it contains spoiler information about the solution