[reference] : https://www.codingame.com/ide/puzzle/darts
I pass all tests but not the third validator “Chaotic Ties”.
This is my algo in java :
(because of Polygon object in java doesn’t include boundaries, we have to make it manually)
i compute radius with width/2, ofc.
if at least one coordinates are not in [-radius;radius], it’s 0 point.
i check if x and y are positivie, so i can check if we are in the diamond square.
For example, you have a straight between coordinates [-radius;0] to [0;-radius]. you can parametrize your straight with y + x = -radius. So i check if y+x >= radius.
I do it for the 4 combinaisons of -radius <= x || y <= radius.
If one test is ok, it’s +15 points.
If not, i check if it’s in the circle with the classic sqrt(x²+y²) <= radius
After i sort by values, with a stream.
Anyone had this problem ? Or maybe anyone has a test data that can represent this validator ?
Thank you in advance.