Guaranteed Hit?
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.
a distance less than 36 is impossible in robocode, but a correct formula should give correct result in this case. So I prefer the atan approach.
asin approach is incorrect by geometry as well.
however trigs are always expensive, so using 18 / distance is acceptable since it gives similar result.
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
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.