User:Nat/TargetingProblem
< User:Nat
Jump to navigation
Jump to search
Can anyone answer my question?
I've some targeting system that I create it accidentally and it work well (for those nanobot):
double absBearing, vel; // find average velocity avgVelocity = (avgVelocity + Math.abs(vel = e.getVelocity())) / 2; // the avgVelocity is preloaded as 4 // Targeting setTurnGunRightRadians(robocode.util.Utils.normalRelativeAngle( (e.getBearingRadians() + getHeadingRadians()) + Math.asin( // This is a magical line! at first it look like this: // Math.sin(e.getDistance()) * vel // but for hit StopNGo movement, I must assume a magic velocity in order to // hit it. I also need an average velocity in order to hit SittingDuck! Math.sin(e.getDistance()) * ((avgVelocity < 0.00001 || vel > 0.5) ? vel : 4.5 * ((vel > 0) ? 1 : -1)) / (20 - 3 * 1.9) ) - getGunHeadingRadians() )); // 2 is cheaper than 1.9! setFire(2D);
That code copy almost exactly from one of my robot using it (not yet released). Can anyone answer me how this gun hit so much, or it just one kind of RandomTargeting?
Note: I don't have answer, this is not a joke!
Note: Please answer on this page, not a discussion page!