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.
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.
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.
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
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
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.
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
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
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 :
@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.
My bad, the error from validator 2 came from a 65 speed, not a dupe.
Problem fixed, then.