https://www.codingame.com/training/medium/particle-detection-with-cloud-chamber

Send your feedback or ask for help here!

Created by @LaurentValade,validated by @Marchete,@Fluxor and @LastRick.

If you have any issues, feel free to ping them.

https://www.codingame.com/training/medium/particle-detection-with-cloud-chamber

Send your feedback or ask for help here!

Created by @LaurentValade,validated by @Marchete,@Fluxor and @LastRick.

If you have any issues, feel free to ping them.

Really unique puzzle, was fun to code and approve. But Iām having issues now with Validator 1 (all tests and other validators pass). Is Val 1 still the straight line shown on the contribute page?

1 Like

I encountered a few issues while solving this.

- the statement requests rounding to the tenth, yet all test/validator outputs are integral
- I find a very different radius for test 6 (55 vs 60). I work around it by recomputing the radius from the known particle properties, but itās unclear this is what is asked. (seems to impact validators 4 and 6)
- the relative g error formula threshold of 0.5 consistently confuses protons and alpha. Using 0.4 or picking best match works around it, butā¦ why give a specific formula if it canāt work?

Great puzzle otherwise. Nice to see a good use of ASCII art for once.

2 Likes

Same for point 2, I used a statistical approach and ended up filtering the points aggressively (sigma <= 2) to get results in line with the expected output.

Also same for point 3, in that case I simply took the particule with the least error (closest to 0) and it worked, but thatās not something covered in the description.

I imagine the difference in radius for Test 6 is due to the issue in your first line. The confusion comes from the author using the word ātenthā. Here, it doesnāt mean ā0.1ā (to the right of the decimal); instead it means āto the nearest multiple of tenā. Something like "10*(int(radius/10)).

1 Like

If the radius is computed correctly (see my other note), you shouldnāt need that kind of check on least error. In my code (Dart), I found that using StringAsFixed(4) is enough accuracy to match the q/m values in the table.

For test 4 you do. If you use the correct radius of 60 you get a value of 0.49664609605580906 for the proton, and 2.0204107484267375e-16 for the alpha particle. Both are strictly under 0.5.

Not sure where those values are coming from. According to the table, g = Q/m, which for alpha is around 0.005 (2/3727), while proton Q/m is 0.001 (much smaller). Using R = 60 in the gammaV BRC equation (right side of the equation), g ~ 0.005. My code is literally a stack of if-statements like:

g.toStringAsFixed(4) == (2/3727).toStringAsFixed(4)

and this is enough to pass the tests.

Well, except Validator 1. Would love to know why I canāt get past that.

The formula for G is `1e6 * V / (B * R * c * ((1 - V ** 2) ** 0.5))`

, for a radius of 60 that gives you `0.000536624631070566`

.

The proton has a g_p value of `abs(charge) / mass`

which is `0.0010660980810234541`

If you compute the final formula `abs(g_p - G) / g_p`

you get `0.49664609605580906`

.

I assume that your calls to toStringAsFixed are doing some rounding and thatās why you may not get the same result.

1 Like

Exactly!

Iām sorry for this mistake, I am quite weak in English !

I would like to correct it, but I donāt know if I can still edit a puzzle after its approvalā¦

You can edit your puzzle from its contribution page, even after its approval.

1 Like

Hi Djoums,

I am not sure to understand where your problem came from, maybe it is because of my error in the statement with Ā«nearest tenthĀ» instead ef Ā«the nearest multiple of 10Ā».

Before writing this answer, I was sure that the `abs(q)/m`

particle interval does not overlap as I choose the value `.5`

for the threshold of `abs(g_p - G) / G`

such as, but my bad, `abs(q)/m`

interval of proton and alpha overlap !

```
e- : q = -1, m = 0.511 ==> abs(q)/m = 1.96 : G ā [ 0.978, 2.94]
p+ : q = 1, m = 938.000 ==> abs(q)/m = 0.00107 : G ā [0.000533, 0.0016]
n0 : q = 0, m = 940.000 ==> abs(q)/m = 0 : G ā [ 0, 0]
alpha: q = 2, m = 3727.000 ==> abs(q)/m = 0.000537 : G ā [0.000268, 0.000805]
pi+ : q = 1, m = 140.000 ==> abs(q)/m = 0.00714 : G ā [ 0.00357, 0.0107]
```

I took this criterion as a detail, but the devil is in the details!

So maybe I should change the statement

Likewise, the ratio

g = |q|/mcould not be computed exactly. Letās noteg_pthe theoritical value of particlep(given in the table below) andGthe computed value from picture with the formula above.

If

`abs(g_p - G) / g_p < .5`

one can conclude that the particle which just passed through the cloud chamber wasp.

If none of the five known particle satifies

`abs(g_p - G) / g_p < .5`

one can conclude that the particle which just passed through the cloud chamber is unknown.

for

Likewise, the ratio

g = |q|/mcould not be computed exactly. Letās noteg_pthe theoritical value of particlep(given in the tableabove) andGthe computed value from ASCII-art picture with the formula above.

The particlepwhich just passed through the cloud chamber is the one with the minimal value of

`abs(g_p - G) / g_p`

if this value is stricly below`.5`

, i.e. :

`abs(g_p - G) / g_p < .5`

If`G`

is such that

`abs(g_p - G) / g_p >= .5`

for every known particles (those in the table above), one can conclude that the particle which just passed through the cloud chamber is unknown (as its value of`abs(q)/m`

is too far from every known particle).

An other solution would be to change the threshold `.5`

for a smaller value, but

- it would make the game a lot harder because a better precision on the computed radius would be needed,
- it would not be backward compatible for the test/validator.

What do you think?

Thank you !

Indeed, there were some mistake in the statement, sorry !

About your first point, as explained by @LastRick I wrote Ā«closest tenthĀ» instead of Ā«nearest multiple of 10Ā».

About your second and third point, the statement was indeed unclear and ambiguous, see my answer to @Djoums :

[Community Puzzle] Particle Detection with Cloud Chamber

2 Likes

I think itās fine to take the particle with the lowest ratio, thatās what I did intuitively. Mentionning it in the description like you proposed would be enough

1 Like

Iāll do that

Done !

I really enjoyed this one, even tho it all comes to finding the center of a circle, the context is original.

I didnāt use any statistics, just chose three points on the circle and deduced the center from that.

To make sure the three points are not too close from each other (which would mess the precision), I do the following:

- choose any point A on the circle
- choose a point B on the circle that maximizes AB
- choose a point C on the circle that maximizes AC x BC

1 Like

Thank you and well done !

The 3 points solution is much simpler that the overkill mine that use gradient descent along the greatest steep. My wife solved it with this method too !

I created this puzzle with the idea that one use every points of the particle path to use all the information given, but three points well chosen are enough ! After a little bit of disapointment, I am happy that you and others (including my wife) have found a simpler solution; simpler is better, faster, stronger !