# [Community Puzzle] Stall tilt

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

I require assistance.
I cannot, for the life of me, understand why in the world, in the first example, f comes before d…
F has a speed of 25, D has a speed of 23. The optimal speed is 22. They both fall on the second turn. They should come alphabetically, d, then f.
Am I missing something???

Same on the second version. How does F(V=33) come before A(V=20) when the limit speed is 18?

In first example, F comes before D because it has a higher speed.

Ordering of the ones who fall down is first by the number of laps completed, then by speed and finally by name.

1 Like

Thank you Tutmalo!
This is completely unclear in the description, which is very poorly worded and could just as well ask for alphabetical order.
I am rather disappointed by this puzzle.