[Community Puzzle] Stall tilt


#1

https://www.codingame.com/training/medium/stall-tilt

Send your feedback or ask for help here!

Created by @Magicien-d-oz,validated by @bbb000bbbyyy,@daifei4321 and @JBM.
If you have any issues, feel free to ping them.


#2

Hi!

I’m trying to figure out how to use the formula in the description but it seems for me that me or the description has missing something.
The formula from description is tan(θ) = v² / (r * g). Also the statement says that bike will stall when angle < 30. So I tried to express the v from the formula above:
v=sqrt(tan(θ) * r * g).

And now I’m looking at the Duel test to make sure my formula is correct, as it’s the simplest (there is only one curve with radius 60m).
If I use my formula to calculate the maximum constant speed, I get v = sqrt(tan(30) * 60 * 9.81) ≈ 18
But the test expects it to be 31. I’m not that good in physics and probably that ‘constant maximum speed’ is a tricky thing that I should have understood in different way, or maybe I’m also not that good in math :slight_smile: so my formula just isn’t correct.
Could someone please point me where to look?

Thanks.


#3

As said in the statement:

θ = angle with respect to the vertical (degrees)

while:

A motorcycle will stall if the angle to the ground is < 30 degrees.


#4

Oh, that’s what I was missing. Thank you a lot!


#5

Hi everyone !
Learning Python since a few days, I still learning the syntax. Codin game is here for me to improve my skill.
And here, I’m blocked.

Below my python’s code for calculate the optimal speed:

Method which gives our optimum speed

def OptimumSpeed(listRadius = [0]):
minRadius = min(listRadius)
v = sqrt(atan(60) * (minRadius * 9.81))
return ceil(v)

For the case “Real case”, expected is 29, my code gives 28.
For all the others cases, it works, but not here, and I don’t understand why.

Did you see something wrong ?
Thanks


#6

I’m pretty sure you actually mean tan here (instead of atan) and it expects an argument in radians.

Not related, but using mutable objects as default parameter (listRadius = [0]) can be dangerous.


#7

Oh yeaaaaaaaaaaaah Niako. Green, green, green. You were so right !
I put atan instead of tan !
And true, I set parameter in degree rather than radians.

Will take a look on your advice.

Thanks a lot


#8

Hi, @Magicien-d-oz

I’ve a strange behaviour with my code. When I test, I pass 1,4,5 & fail 2,3 but with the validators after submission I pass 2,3,4,5 & fail 1 !!!

I don’t really see what could be wrong ??

thanks by now

Philippe


#9

I’d suggest passing first all IDE tests before worrying about the validators.