# [Community Puzzle] Stall tilt

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

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

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 so my formula just isnāt correct.
Could someone please point me where to look?

Thanks.

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.

2 Likes

Oh, thatās what I was missing. Thank you a lot!

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

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

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.

1 Like

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.

Thanks a lot

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

Iād suggest passing first all IDE tests before worrying about the validators.

Hi,
I pass all tests. But when I submit my code I have some fails. The strange thing is thatās never the same which fail( just the one or 1 and 2 or 2,4,5).
Is there a time constraint?
Thanks
Yohan

@YohanC Interesting. Considering the puzzle and the fact that you pass all tests, itās unlikely to be related to the time limit.
If youāre using a low-level language such as C/C++, are you sure to properly initialize all your variables/arrays?
If thatās not the issue, you can send me your code in PM, Iāll have a look.

I canāt understand this formula:
tan(Īø) = vĀ² / (r Ć g)
what Īø and what r should i put to find optimal speed?

I mean, what is āangel with respect to the verticalā?
And what radius of bend should i take?

If you have experience of riding a bicycle or a motorcycle (or if you observe how people are doing these), you should know that when you are making a turn, you have to tilt the bike a little (make an āangel with respect to the verticalā). The higher speed you are in, the larger angle you need to tilt.

But you cannot tilt too much. If you tilt 90 degree you are already fallen to the ground. There is a limit to the degree of the tilt, and this limit is given in the puzzle:

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

This angle limit also limits the speed in a turn. If the speed is higher than a limit, it falls.

By these info, you will see that some bikes are over-speeding in some turns. They will fall down and affect the race result.

Feedback:

That is a terrible explanation for counter steering. You can counter steer by leaning the body of the bike, but that is a horrible and possibly dangerous way to counter steer. To properly counter steer you turn the front wheel in the opposite direction of where you want to go. This alters the the angular momentum of wheel, and the angular inertia will tilt the bike in order to conserve the angular momentum. You do not need to tilt the bike yourself. Then, to exit the counter steer (or to straighten the bike), you point the front wheel forward again.

The name counter steering comes from the fact that you are steering in the opposite direction that you want to turn. A rider that manually tilts their bike, might keep the front wheel straight or even worse, they might even steer the wheel into the direction that they want to go. This incorrect steering is why your explanation on how to counter steer is physically dangerous.

You may have noticed that professional riders lean into the turn by quite a bit. That is not counter steering, and they are not tilting the bike over. As long as they are not going in a straight line, they are doing the opposite of tilting the bike; one might even be able to argue that they are counter tilting the bike. Those riders are not just leaning over, they are shifting their entire body over. Their butt-cracks are no longer over the center of their seats. By moving to the side (or hanging off of the side), they are altering the bikeās center of gravity, causing it to tilt in the opposite direction in order to maintain its line of movement (or keep its balance). This reduces the amount of tilt needed for turns or it can be used to get a sharper turn with the same amount of tilt. The center of the wheel has more contact area with the road, but you are not using center of the wheel when the bike is tilted over. The reduction in contact reduces the maximum speed at which you can maintain traction with the road. By reducing the bikeās tilt, they can get contact that is closer to the center of the wheel. Again, this leaning is not counter steering, but it is something that is done along with counter steering. You can counter steering without leaning over the edge of the bike. You can also lean over the edge of the bike without turning, but this will cause the bike to tilt in the opposite direction in which you are leaning in order to stay balanced and keep going straight (it look really dumb).

Those points were made to the author at puzzle creation time. (see the contribution page) He wasnāt very receptive.

Iāll have to take a look. As a former (and hopefully future) rider, I had to point it out simple because that explanation was horrifying. I donāt even want to think about what would happen to someone that manages to turn the front wheel in the direction of the turn because they forcefully tilted the bike.

By the way, is there I link to the contribution page? Iām having some trouble finding it.

Here it is (at your xp lvl, you could not directly have access to it). That said, itās not really āa terrible explanation for counter steeringā, itās just that this problem has nothing to do with counter-steering and what the author refers to as counter-steering could simply be called ācentripetal tiltā as JBM says in the comments.

Hi,
I found two major issues with this puzzle.
My solution was passing all tests so I confidently submited but my submission failed two validators.
I really couldnāt figure out why so I searched the contribution to see the validators and hereās what I found :

• Validator 1 has a speed of 62 while itās said in the puzzle that max speed is 59,
• Validator 2 has two motorcycles of same speed, and it sorts them by descending tag, which is random, so either the puzzle explains how to sort motorcycles of same speed, or this case shouldānt be possible at all (a comment of the author suggests that it shouldānt happen).

@pardouin I edited to fix the constraints, thanks for noticing. However, all input speeds are already distinct (and distinct from the optimal speed) in every test/validator.

1 Like

My bad, the error from validator 2 came from a 65 speed, not a dupe.
Problem fixed, then.

1 Like