[Community Puzzle] Particle Detection with Cloud Chamber

@abrman I think you have well understood the statement.
Test 6 and validator 6 are the most difficult to pass because they have the smallest arc angle.
I think the most likely is that you find the right particle at validator 6, but there is an error on the radius. As the radius should be rounded to the closest multiple of 10, I think you are close to the treshold, on the right side for the test 6, but on the wrong side for validator 6.
Actually, several codingamers (including myself) have had problems with validator 6, and afaik, it was always a problem of accuracy on the radius.
Perhaps the validator 6 is a little bit more difficult than test 6… despite that they are very similar.
I feel sad that you pass every test but not every validator, it happened to me a few times and I know it’s quite a pain and annoyance!

I wish you success with this puzzle, and I hope it will be the one that gets you to level 20 :smiley:

@TwoSteps Would it be OK to switch test 6 with validator 6 ? Or at least, change validator 6 to make it a little be more easy (by increasing the arc angle of the particle path) ? I’m afraid it would break some already validated answer.
But I would like to make sure that any code that passes all the tests, also passes all the validators.

Several random tries later I’m lvl 20 :slight_smile:
You were right & thanks!

1 Like

Another option is to make test case 6 more difficult and tricky, comparable to the validator.

I’m afraid it would break some already validated answer

You can use some existing solutions to check with your new cases.

I would like to make sure that any code that passes all the tests, also passes all the validators.

That is a good wish though theoritically and practically it is impossible to be assured.

On-the-job programmers should get used to such scenerio when debug can only be done by reverse-engineering or black-box testing.

BTW, that’s an interesting puzzle.

1 Like

In order to solve validator 4, I had to confine my point selection to the exterior left side of the curve. Apparently, mixing inside and outside points from the particle path added enough error to throw off my radius calculation.

Validator 4 (and possibly 6, judging by other posts here) may be demanding higher resolution than the ASCII art contains, at least for 3-point center finding.

Still, a fun puzzle. :slight_smile:

P.S.: And that change caused my code to fail test case 6, while passing validator 6.

Ok, update:

I finally have a solution that passes all test cases and all validators. Validator 4 was always the problem child, at least for my approach to the problem. It took some statistical analysis and point hunting at the 0.1m scale in order to resolve the circle centers finely enough to solve both case 4’s and both case 6’s with one generalized algorithm. Whew. Looks like the other published solutions tended towards finding more accurate coordinates for the particle path before starting in on any calculations. Sigh. You can do something the MACKEYTH way, or the easy way.

A tip for those intrepid souls that dare this puzzle: you’ll need to work out a way to find the center line of the particle path to a resolution of less than 1 m. The radius of several cases is perilously close to the rounding boundary between 2 different multiples of 10.

@LaurentValade, physics must be a cruel mistress if she subjects you to this sort of thing. :wink:

I’d make the IDE test more difficult as @FoxLee suggested, if you’re really sure it will improve the puzzle.

Hi there, I haven’t taken Math nor Physics for a really long time, just want to get some clarification here, are we using the formula below to calculate the radius?

h/2 + w^2/8h

Or the formula for ellipse?

x^2 + y^2 = r^2

Any help is appreciated :slight_smile:

Without any formula, if you take 2 points on the circle, you know that the center of the circle lies on the perpendicular bisector of these 2 points.

So with this property in mind, you can get a good approximation of the exact position of the center by chosing 3 points of the circle, reasonably far from each other to have a good precision.

1 Like

What is impressed me is that my wrong assumptions gives 100% score. When I collect points which are to be “part of a circle” I go line by line and if char is ’ ’ I add pont with (j,i) to list. But…when the curve is full ellipse for example then last “point” on the i-th line should NOT be appended with first “point” on the (i+1)-th line !!! I know it is bull shit. But because I am lazy ass I still do this wrong thing. And somehow…it works. but should not work in any Universe ))))

You can go about obtaining this radius in several different ways. Least squares method, using a formula with 3 points… I started with this simple formula for the area of the triangle : A = abc / 4R, knowing that the area is half of the cross product of the 2 vectors. Then I use it on 3 points “reasonably” scattered on the shape. It works like a charm, in less than 10 lines of code… I didn’t even need to optimize the selection of the 3 points (like when there are several consecutive spaces on the same line, prefer the one in the center, for instance)…