Difference between revisions of "Talk:Linear Targeting"

From Robowiki
Jump to navigation Jump to search
(Changing to use new template)
(Stuart)
Line 7: Line 7:
  
 
----
 
----
 +
 +
I find the noniterative targeting 100% accurate aside from walls if you replace the 13 with a 10.  I was fooling around with the code to try and make it more accurate, and I made a discovery!
 +
New code:
 +
<pre>
 +
double absoluteBearing = getHeadingRadians() + e.getBearingRadians();
 +
setTurnGunRightRadians(Utils.normalRelativeAngle(absoluteBearing -
 +
    getGunHeadingRadians() + (e.getVelocity() * Math.sin(e.getHeadingRadians() -
 +
    absoluteBearing) / 10.0)));
 +
setFire(3.0);
 +
</pre>
 +
Does anyone else get the same results?  I hope so.  If it does, I'll be... remembered!  For a very small thing... But...  But I'll be like, on a very small scale, like [[ABC]], like all of the "Robocode scientists", I will have made a discovery!  I'll be so happy with myself! =')
 +
--[[User:Awesomeness|Awesomeness]] 22:39, 16 March 2009 (UTC)

Revision as of 23:39, 16 March 2009

Credits - Example of Noniterative Linear Targeting
Old wiki page: LinearTargeting/NanoLinearTargeting
Original author(s): Kev



I find the noniterative targeting 100% accurate aside from walls if you replace the 13 with a 10. I was fooling around with the code to try and make it more accurate, and I made a discovery! New code:

double absoluteBearing = getHeadingRadians() + e.getBearingRadians();
setTurnGunRightRadians(Utils.normalRelativeAngle(absoluteBearing - 
    getGunHeadingRadians() + (e.getVelocity() * Math.sin(e.getHeadingRadians() - 
    absoluteBearing) / 10.0)));
setFire(3.0);

Does anyone else get the same results? I hope so. If it does, I'll be... remembered! For a very small thing... But... But I'll be like, on a very small scale, like ABC, like all of the "Robocode scientists", I will have made a discovery! I'll be so happy with myself! =') --Awesomeness 22:39, 16 March 2009 (UTC)