Guaranteed Hit?
asin(botWdith / (distance - 18)) is incorrect because when distance = 18 it gives NaN instead of PI.
if you assume a bot is a circle then asin(botWidth / distance) is correct; if you assume a bot is a square then atan(botWidth / (distance - 18)) is correct as long as absolute bearing from source to target is 0, 90, 180 or 270 degrees.
however, a moving bot is neither a circle nor a square, that’s why precise intersection is used.
Anyway, botWidth / distance is fine as long as distance is far, and the result is almost the same as the asin/atan version.
It gives a NaN but a distance less than 36 is impossible in robocode. botWidth / distance is always incorrect, asin(botWidth / distance) is always incorrect too but it less incorrect however, asin(botWidth / (distance - 18) is correct in four cases and gives higher results than all other imprecise formulas which always results in closer results to the precise one.
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
I haven't checked it in Java but asin(positive infinity) results in positive infinity which is true for the bot width formula if we assume that the bullet starts from the robot location. The same case also happens with Traditional MEA when bullet speed is 0.
Wrong. Infinity means nothing in radians. Valid values are 0~2pi or -pi~pi or so.
An angle should never be infinty radians.
If it means nothing can't we assume that the traditional formula is completely wrong since with a bullet velocity of 0, it will return positive infinity.