<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://robowiki.net/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Bostonvaulter</id>
	<title>Robowiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://robowiki.net/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Bostonvaulter"/>
	<link rel="alternate" type="text/html" href="http://robowiki.net/wiki/Special:Contributions/Bostonvaulter"/>
	<updated>2026-04-30T03:04:00Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>http://robowiki.net/w/index.php?title=RoboRumble&amp;diff=16196</id>
		<title>RoboRumble</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=RoboRumble&amp;diff=16196"/>
		<updated>2010-05-13T03:27:39Z</updated>

		<summary type="html">&lt;p&gt;Bostonvaulter: fixed link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
The ultimate collaborative effort to have a live, up-to-date ranking of Robocode bots. It uses the power of available Robocoders' computers to distribute the effort of running battles and building the rankings. Currently RoboRumble@Home is hosted on [[Darkcanuck/RRServer|Darkcanuck's RoboRumble server]].&lt;br /&gt;
&lt;br /&gt;
To submit a bot to Darkcanuck's server see [[RoboRumble/Starting With RoboRumble|Starting With RoboRumble]]&lt;br /&gt;
&lt;br /&gt;
== Current Rankings ==&lt;br /&gt;
* [http://darkcanuck.net/rumble/ RoboRumble Server Home]&lt;br /&gt;
* [http://darkcanuck.net/rumble/Rankings?version=1&amp;amp;game=roborumble 1-vs-1 Rankings]&lt;br /&gt;
* [http://darkcanuck.net/rumble/Rankings?version=1&amp;amp;game=meleerumble Melee Rankings]&lt;br /&gt;
* [http://darkcanuck.net/rumble/Rankings?version=1&amp;amp;game=teamrumble Team Rankings]&lt;br /&gt;
&lt;br /&gt;
== News ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float:right;margin-top:-2.65em;margin-right:2.85em&amp;quot;&amp;gt;[[{{fullurl:Template:RoboRumble@Home/News|action=edit}} Edit News]]&amp;lt;/div&amp;gt;&lt;br /&gt;
{{RoboRumble@Home/News}}&lt;br /&gt;
&lt;br /&gt;
{{Navbox RoboRumble}}&lt;br /&gt;
[[Category:Competitions|RoboRumble@Home]]&lt;/div&gt;</summary>
		<author><name>Bostonvaulter</name></author>
		
	</entry>
	<entry>
		<id>http://robowiki.net/w/index.php?title=RoboRumble&amp;diff=16195</id>
		<title>RoboRumble</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=RoboRumble&amp;diff=16195"/>
		<updated>2010-05-13T03:26:55Z</updated>

		<summary type="html">&lt;p&gt;Bostonvaulter: added link about submitting a bot&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
The ultimate collaborative effort to have a live, up-to-date ranking of Robocode bots. It uses the power of available Robocoders' computers to distribute the effort of running battles and building the rankings. Currently RoboRumble@Home is hosted on [[Darkcanuck/RRServer|Darkcanuck's RoboRumble server]].&lt;br /&gt;
&lt;br /&gt;
To submit a bot to Darkcanuck's server see [[Starting With RoboRumble]]&lt;br /&gt;
&lt;br /&gt;
== Current Rankings ==&lt;br /&gt;
* [http://darkcanuck.net/rumble/ RoboRumble Server Home]&lt;br /&gt;
* [http://darkcanuck.net/rumble/Rankings?version=1&amp;amp;game=roborumble 1-vs-1 Rankings]&lt;br /&gt;
* [http://darkcanuck.net/rumble/Rankings?version=1&amp;amp;game=meleerumble Melee Rankings]&lt;br /&gt;
* [http://darkcanuck.net/rumble/Rankings?version=1&amp;amp;game=teamrumble Team Rankings]&lt;br /&gt;
&lt;br /&gt;
== News ==&lt;br /&gt;
&amp;lt;div style=&amp;quot;float:right;margin-top:-2.65em;margin-right:2.85em&amp;quot;&amp;gt;[[{{fullurl:Template:RoboRumble@Home/News|action=edit}} Edit News]]&amp;lt;/div&amp;gt;&lt;br /&gt;
{{RoboRumble@Home/News}}&lt;br /&gt;
&lt;br /&gt;
{{Navbox RoboRumble}}&lt;br /&gt;
[[Category:Competitions|RoboRumble@Home]]&lt;/div&gt;</summary>
		<author><name>Bostonvaulter</name></author>
		
	</entry>
	<entry>
		<id>http://robowiki.net/w/index.php?title=Random_Targeting&amp;diff=16163</id>
		<title>Random Targeting</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=Random_Targeting&amp;diff=16163"/>
		<updated>2010-05-10T21:10:20Z</updated>

		<summary type="html">&lt;p&gt;Bostonvaulter: /* A simpler solution */ added link to musashi trick&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A method of [[targeting]] that simply chooses a random angle among the angles that could possibly hit the opponent. Some successful [[NanoBots]] use this firing method. Its implementation is very small and for unpredictable movements, it will give a consistent hit percentage.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Add import robocode.util.* for Utils&lt;br /&gt;
// This code goes in your onScannedRobot() event handler.&lt;br /&gt;
&lt;br /&gt;
public void onScannedRobot(ScannedRobotEvent e) {&lt;br /&gt;
    double randomGuessFactor = (Math.random() - .5) * 2;&lt;br /&gt;
    double bulletPower = 3;&lt;br /&gt;
    double maxEscapeAngle = Math.asin(8.0/(20 - (3 * bulletPower)));&lt;br /&gt;
    double firingAngle = randomGuessFactor * maxEscapeAngle;&lt;br /&gt;
    double absBearingToEnemy = e.getBearingRadians() + getHeadingRadians();&lt;br /&gt;
	&lt;br /&gt;
    setTurnGunRightRadians(Utils.normalRelativeAngle(&lt;br /&gt;
            absBearingToEnemy + firingAngle - getGunHeadingRadians()));&lt;br /&gt;
    fire(bulletPower);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== A simpler solution ==&lt;br /&gt;
&lt;br /&gt;
A simpler method is to assume that the enemy is traveling in a circle around you (see [[Musashi Trick]]), which is often true among NanoBots and [[:Category:1-vs-1 Bots|1-vs-1 bots]]. If the enemy is traveling in a circle around you, the maximum distance it can cover before a bullet reaches it is &amp;lt;code&amp;gt;enemy velocity / bullet velocity&amp;lt;/code&amp;gt; (in radians). For example, a power 3.0 bullet fired at an enemy going at full speed should be fired at a [[Bearing Offset|bearing offset]] between -8/11 and +8/11.&lt;br /&gt;
&lt;br /&gt;
== Selecting firepower ==&lt;br /&gt;
&lt;br /&gt;
The advantage of a random gun is that it should have a roughly equal hit rate on any type of movement. This makes ideal firepower selection pretty easy to pre-calculate. In the following equations x is the choice of firepower. It is assumed that damage output per tick is the quantity you're interested in maximizing, it may not be.&lt;br /&gt;
&lt;br /&gt;
Bullet damage, assuming firepower &amp;gt; 1:&lt;br /&gt;
&amp;lt;pre&amp;gt;D=4*x+2*(x-1)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The smallest size of a robot, in radians:&lt;br /&gt;
&amp;lt;pre&amp;gt;S=36/distance&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total escape area, in radians:&lt;br /&gt;
&amp;lt;pre&amp;gt;A=2*asin(8/(20-3*x))&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Probability of a hit, assuming uniform spread of bullets over A:&lt;br /&gt;
&amp;lt;pre&amp;gt;P=min(1,S/A)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The expected damage from a shot:&lt;br /&gt;
&amp;lt;pre&amp;gt;E=D*P&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heat created by a shot:&lt;br /&gt;
&amp;lt;pre&amp;gt;H=1+x/5&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The firing frequency:&lt;br /&gt;
&amp;lt;pre&amp;gt;F=1/ceil(H/0.1)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Expected damage per tick of combat:&lt;br /&gt;
&amp;lt;pre&amp;gt;DPS=E*F&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Back substitution to get the expected damage per tick in terms of distance and x and optimization of DPS are left as an exercise for the coder.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Maximum Escape Angle]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Simple Targeting Strategies]]&lt;/div&gt;</summary>
		<author><name>Bostonvaulter</name></author>
		
	</entry>
	<entry>
		<id>http://robowiki.net/w/index.php?title=Guess_Factor_Targeting&amp;diff=16153</id>
		<title>Guess Factor Targeting</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=Guess_Factor_Targeting&amp;diff=16153"/>
		<updated>2010-05-10T07:51:09Z</updated>

		<summary type="html">&lt;p&gt;Bostonvaulter: Redirected page to GuessFactor Targeting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT[[GuessFactor Targeting]]&lt;/div&gt;</summary>
		<author><name>Bostonvaulter</name></author>
		
	</entry>
	<entry>
		<id>http://robowiki.net/w/index.php?title=Guess_Factor_Targeting&amp;diff=16152</id>
		<title>Guess Factor Targeting</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=Guess_Factor_Targeting&amp;diff=16152"/>
		<updated>2010-05-10T07:50:33Z</updated>

		<summary type="html">&lt;p&gt;Bostonvaulter: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[#REDIRECT GuessFactor Targeting]]&lt;/div&gt;</summary>
		<author><name>Bostonvaulter</name></author>
		
	</entry>
	<entry>
		<id>http://robowiki.net/w/index.php?title=Guess_Factor_Targeting&amp;diff=16151</id>
		<title>Guess Factor Targeting</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=Guess_Factor_Targeting&amp;diff=16151"/>
		<updated>2010-05-10T07:50:21Z</updated>

		<summary type="html">&lt;p&gt;Bostonvaulter: Created page with 'REDIRECT GuessFactor Targeting'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[REDIRECT GuessFactor Targeting]]&lt;/div&gt;</summary>
		<author><name>Bostonvaulter</name></author>
		
	</entry>
	<entry>
		<id>http://robowiki.net/w/index.php?title=EscapeEnvelope&amp;diff=16150</id>
		<title>EscapeEnvelope</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=EscapeEnvelope&amp;diff=16150"/>
		<updated>2010-05-10T07:47:53Z</updated>

		<summary type="html">&lt;p&gt;Bostonvaulter: Redirected page to Escape Envelope&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT[[Escape Envelope]]&lt;/div&gt;</summary>
		<author><name>Bostonvaulter</name></author>
		
	</entry>
	<entry>
		<id>http://robowiki.net/w/index.php?title=GuessFactor_2D&amp;diff=16149</id>
		<title>GuessFactor 2D</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=GuessFactor_2D&amp;diff=16149"/>
		<updated>2010-05-10T07:47:41Z</updated>

		<summary type="html">&lt;p&gt;Bostonvaulter: added a link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A variation of GuessFactorTargeting which uses elements DynamicSegmentation and [[EscapeEnvelope]] targeting to both enhance exactness of EscapeRadius based GuessFactorTargeting and to give PatternMatching like results against bots not using PerpendicularMovement.&lt;br /&gt;
&lt;br /&gt;
The system works by taking into account maximum distances achievable in all directions in a certain amount of time given its current velocity (EscapeEnvelope / EscapeArea) and rotates that in accordance to the targets current heading.  The field is then segmented two dimensionally, which starts at a very low level of segmentation and which proceeds to become finer as more data is collected (DynamicSegmentation).  By segmenting this data by velocity and heading if the target appears to be not traveling perpendicularly, a result quite similar to PatternMatching is then achieved.&lt;br /&gt;
&lt;br /&gt;
Firing takes place by selecting the angle which will pass through the highest probablility areas.&lt;br /&gt;
&lt;br /&gt;
While this proves to be just as effective as regular GuessFactorTargeting against RandomMovement, has a much better hit rate against basic patterns, and is easy to modify to attack high or low guess factors.&lt;br /&gt;
&lt;br /&gt;
This is a combination of me being tired of getting only average hitrates against most patterned bots, and the conclusion that the wave surfer vs guess factor challenge is just going to end up in a method of constant second guessing of yourself (he will think I will use guess factoring, so he will move to the low factors, but then he will think im thinking that, and so he will move to the high factors, but he will think im thinking hes thinking that so he will move to low, etc...).&lt;br /&gt;
-- [[Jokester]]&lt;br /&gt;
&lt;br /&gt;
Have you tried running a TargettingChallenge with this type of targetting? I am very curious to see the results. -- [[Alcatraz]]&lt;br /&gt;
&lt;br /&gt;
Ah, you just reminded me what my hangup was on this before - if I don't calculate things based on the current heading of the enemy rather than on the angle to me, I didn't see a consistent way to project it back for targeting if the enemy was facing a different direction relative to me.&lt;br /&gt;
&lt;br /&gt;
However, if that proves to not really matter, or there is a good way to map back to the differently proportioned escape envelope, then I think the whole algorithm is MiniBot-able by using AffineTransform cleverly (maybe, unless that way to map it back makes it unhelpful). -- [[Kawigi]]&lt;br /&gt;
&lt;br /&gt;
Well I really need to try using this AffineTransform class.  I am currently mapping the escape area as a rectangle (it works fairly well because the unreachable areas just never get incremented) and then basically rotating the entire battlefield so that the enemy has a heading of 0, only changing my relative point.  I then calculate the best angle based on that, and reverse the process to get the exact angle I need to fire at.  If I can change this around and be able to rotate a polygon around a position I will be able to drastically reduce code size and use my algorithms for the definitive shape. -- [[Jokester]]&lt;br /&gt;
&lt;br /&gt;
Ok, so I basically have GF split into 3 sections:&lt;br /&gt;
# Getting information&lt;br /&gt;
# Segmenting information&lt;br /&gt;
# Selecting angle&lt;br /&gt;
&lt;br /&gt;
In my opinion, 2 is the heart and soul of a good GF gun, and so that is what I am working on.  At the moment, I have a Factor class which is basically my wave, but which contains all information I might want to segment on.  A major plus of my 2D system is that it removes the need to segment on heading, velocity, etc, since that is directly applied on my information (although I am still keeping track of them in my Factor class just in case).  I am incredibly fond of the [[WikiTargeting]] idea, and am currently trying to implement it, but I need to come up with a good way to decide which segment is best.  The three ideas that I have been working with are the most even split (closest to 50/50), the best entropy split, or there is the obscure point split that is mentioned on the WikiTargeting page (choosing the one with the highest sum peaks??? 865 vs 687?). my current segmentations are:&lt;br /&gt;
* Bullet Power&lt;br /&gt;
** Probably unnessecary&lt;br /&gt;
* Distance&lt;br /&gt;
** Probably unnessecary&lt;br /&gt;
* Target Velocity&lt;br /&gt;
** Probably unnessecary&lt;br /&gt;
* Target Heading&lt;br /&gt;
** Probably unnessecary&lt;br /&gt;
* Target Acceleration State&lt;br /&gt;
* Time since last reverse&lt;br /&gt;
* Time since last bullet&lt;br /&gt;
** Used for my every tick factors&lt;br /&gt;
* Near center/wall/corner&lt;br /&gt;
If you can think of any other good ones that would be great.  Then all I do is select the best suited factor and fire on it.&lt;br /&gt;
&lt;br /&gt;
All this work with segmentation has made me think about an exploitation of highly segmented guns.  To try to flatten your profile not just by GF but by segmentation, so the main aim is that they dont have enough data in their segments.  It will probably turn out to be wildly inefficient and not give much return (mostly because to have best effect you need to know the segmentation of the opponent), but it could be interesting to watch the bot go around through all possible velocities, acceleration states, headings, etc.&lt;br /&gt;
-- [[Jokester]]&lt;br /&gt;
&lt;br /&gt;
This (segmented flattening) is actually what most WaveSurfer's do. -- [[PEZ]]&lt;br /&gt;
&lt;br /&gt;
It would be *very* interesting if you were able to find a practical implementation of WikiTargeting. I'm following this with great interest. Keep us posted! --[[Vic]] &lt;br /&gt;
&lt;br /&gt;
Well I am still toying with the efficiency problem, but I have a few ideas.  The processor power required is exponentially related to the number of segments there are to deal with, and the way you decide which implementation to use.  I am currently working on two versions together, an ideal version of WikiTargeting if it had all the processing in the world, and a very basic version which splits data as equally as possible and doesnt go back to check the accuracy of early segments.  One thing that I will need to test is how nessecary segmentation is in the face of GuessFactor2D, because it is mapping guess factors based on all of those variables.  Ive currently been splitting my time between about 12 different projects, so over the next week or so I am going to spend my robocoding time just on this targeting to try to get it finalized. --[[Jokester]]&lt;br /&gt;
&lt;br /&gt;
Looking back at my own WikiTargeting ramblings, the 'ideal world' version (as you call it) *is* available if you are willing to use prepopulation. You can write an offline program that converts raw data into a bunch of dynamically segmented SuperNodes. This is in fact the initial WikiTargeting way. The existence of SuperNodes has allready been proven, so this should work. Although there are those in this community that do not approve of prepopulated guns.&lt;br /&gt;
&lt;br /&gt;
I think your second version may not work so good, unless you have come up with an ingenious solution. I have thought about such an implementation too and using that scheme you will either segment too slowly, or you do not have enough waves per node. --[[Vic]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Targeting Discussions]]&lt;/div&gt;</summary>
		<author><name>Bostonvaulter</name></author>
		
	</entry>
	<entry>
		<id>http://robowiki.net/w/index.php?title=Melee_Strategy&amp;diff=16148</id>
		<title>Melee Strategy</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=Melee_Strategy&amp;diff=16148"/>
		<updated>2010-05-10T07:46:12Z</updated>

		<summary type="html">&lt;p&gt;Bostonvaulter: /* Melee radar */ added link to melee radar implementations&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{cleanup}}&lt;br /&gt;
&lt;br /&gt;
Building a successful [[melee]] bot can be much harder than creating an effective [[1-vs-1]] bot. This page outlines some of the strategies you can use to make your melee bot stronger.&lt;br /&gt;
&lt;br /&gt;
== The timeline of a melee battle ==&lt;br /&gt;
=== 10 bots on the field ===&lt;br /&gt;
; The bots in bad starting positions die right away. Hope you're not one of them.&lt;br /&gt;
If there is someone close to you, it had better die before you.  Most good bots will turn and move away from other bots or from the center in general right away, so if you have some kind of targeting that shoots at the path of least resistance, this is where you'll notice it, but a semi-linear targeting will probably work for that first few seconds in the match.&lt;br /&gt;
&lt;br /&gt;
=== 6-7 bots on the field ===&lt;br /&gt;
; Fighting over corners and trying not to get pushed into crossfires.&lt;br /&gt;
You'll be happier if you're targeting one bot and no bot is targeting you.  You should be able to hit most of the bots you'd reasonably want to target at this point, and you won't be successful with a hit rate of less than maybe 25-30% at this point.&lt;br /&gt;
&lt;br /&gt;
=== 3-4 bots on field ===&lt;br /&gt;
; Everyone stays in their corners and snipes at each other. Try to get the other guys to target each other instead of you.&lt;br /&gt;
This is where you'll be the happiest with solid targeting.  Here's why: when you're down to 4 bots, as David pointed out, there's a ''really'' good chance that you're all in corners.  If the next bot who dies is the one across from you (the one you probably weren't targeting), you are probably next, because you're the most obvious target for ''both'' of the remaining enemies.&lt;br /&gt;
&lt;br /&gt;
=== Duel ===&lt;br /&gt;
; The [[1-vs-1]] fight at the end of a melee battle.&lt;br /&gt;
It should be obvious why targeting is important here.  It's your gun against their movement.&lt;br /&gt;
&lt;br /&gt;
=== What it means ===&lt;br /&gt;
&lt;br /&gt;
In reality, these stages aren't something you normally put into code when making a melee bot, they're observations about what a battle will look like between several good melee bots.  The fact that these stages are defined in terms of position and movement says a lot about what is important in melee. The reason these stages are important to understand is really so that you can analyze your melee bot's performance if you put it in a battle with other bots of a similar level.&lt;br /&gt;
&lt;br /&gt;
== How to put together a good melee bot ==&lt;br /&gt;
As with any kind of new robot, the main thing that's useful when making a new melee robot is to have some kind of idea you want to try.  It can be original or not, it can be a spin-off of what other people have done, or it could just be in general that you want to try making a melee bot.&lt;br /&gt;
&lt;br /&gt;
Nowadays, most people have some experience with 1-on-1 bots before they go too deep into melee.  In reality, melee is just like 1-on-1, except that there's something that supersedes 1-on-1 movement (which is moving in such a way as to not be hit often) - moving in such a way that you aren't being shot at!&lt;br /&gt;
&lt;br /&gt;
=== The theory of melee movement ===&lt;br /&gt;
You'll dodge every bullet if no one is firing at you, and so most melee movement is centered in one way or another around not getting attacked.  This is what makes melee movement so dang interesting.  If it is inevitable that you will be targeted, then you can start worrying about just not being hit.&lt;br /&gt;
&lt;br /&gt;
In discussions with (melee legend) [[ABC]], I remember summarizing these two movement goals combine into the balance between &amp;quot;being in the right place&amp;quot; (not being shot at) and &amp;quot;moving in the right direction&amp;quot; (not being hit).  Since you can only move in one direction, sometimes you have to choose to either mov toward the right place or move in the right direction.  Since different bots prioritize these differently, some will be extremely predictable and easy to hit, but it doesn't matter until someone shoots at them.  In fact, in theory, as long as no one is shooting at you, the only reason you really have to keep moving is to make sure they keep not shooting at you (until they're shooting at you again, which would be nice to be able to magically determine).&lt;br /&gt;
&lt;br /&gt;
=== Common ways of implementing melee movement ===&lt;br /&gt;
There are lots of ways people accomplish the goals of not being targeted and not being hit.  Some common examples:&lt;br /&gt;
&lt;br /&gt;
* [[AntiGravityMovement]] &amp;lt;!--Already transfered to Anti-Gravity Movement, can remove --&amp;gt;&lt;br /&gt;
:In AI I've heard this generalized as using &amp;quot;repulsive fields&amp;quot;.  You could also combine it with attractive fields if you want, but there's rarely a real reason (same goes for tangential fields, for which there is a reason, but the actual implementation is hard to really get right in a pure anti-gravity force-vector sort of way).  The basis of it is just like in physics - you define a set of points that have an antigravitational (repulsive) force on them, you add all the force vectors together, and you let them &amp;quot;push&amp;quot; you in whatever direction they push you in.  Normally other bots and walls are assigned forces.  Sometimes the center of the field has a generic force as well, or even the guessed positions of bullets.  A classic example of [[AntiGravityMovement]] is [[TheArtOfWar]].  A simpler implementation is [[Graviton]], but simpler in this case doesn't necessarily mean more clear (same goes for [[Escape]], which is a more convoluted bot based on [[Graviton]]).  [[Hanji]]'s page has a very stereotypical, very clear implementation of antigravity which might be helpful if you are trying to get into it.  The biggest challenge in getting [[AntiGravityMovement]] right is weighting all the forces effectively, especially when there are more or fewer points on the field (maybe the walls have to push harder when there are more bots on the field pushing you toward them?).&lt;br /&gt;
&lt;br /&gt;
* [[CornerMovement]] &amp;lt;!--Already transfered to Corner Movement, can remove --&amp;gt;&lt;br /&gt;
: In the early days of Robocode, one of the frustrating things about trying to excel in melee was that the bots that seemed to do the best in battle did stupid little patterns in the corners of the battlefield.  This came from the general observation that the bots that lasted to be one of the last standing were the ones that got to the corners the fastest.  While this isn't really always true, there are probably fewer bots near you in a corner than in the middle, so the technique works - just go to the nearest corner, keep moving, and kill anything that's trying to take your corner from you.  I experienced frustration with this movement when I would watch [[SandboxLump]] with his stupidly simple movement kill [[Coriantumr]] in so many of my tests.  Out of my frustration came [[Lib]], the most complex [[CornerMovement]] ever put into a [[NanoBot]] (I assume that's still true, it at least was at the time).  Traditionally, using [[CornerMovement]] will make you specialized as a melee bot, because it tends to work better against the best melee bots than against mediocre ones.&lt;br /&gt;
&lt;br /&gt;
* [[Pattern Movement]] &amp;lt;!--Already transfered to Pattern Movement, can remove --&amp;gt;&lt;br /&gt;
: Alot of quite good nano melee bots just dance around in a star shape, or triangle or square.  Some of these go in a straight line for awhile first (until they hit a wall or something), so it's closer to a type of corner movement than anything.  The virtue of this movement is that you don't move around too much, so you are less likely to have new bots start targeting you because you move into their range, and it does well against the horde of melee nanos with something related to linear or circular targeting (because you change directions relatively often).  [[Gem]], [[Infinity]], [[KomoriNinja]] and [[Trigon]] are good examples of this movement.&lt;br /&gt;
&lt;br /&gt;
; [[MinimumRiskMovement]] &amp;lt;!-- This section has NOT been transferred to the relevant page. --&amp;gt;&amp;gt;&lt;br /&gt;
: On the surface, this looks like just an implementation of [[AntiGravityMovement]], and maybe the difference is just nitpicky semantics to some, but I think the way it is implemented is different enough that the only similarity is really the basic fundamentals of melee movement.  It also seems much more versatile than [[AntiGravityMovement]] and is also less likely to converge at some &amp;quot;happy&amp;quot; local minimum.  As I am biased, I think that the best, clearest implementation of [[MinimumRiskMovement]] is in [[Coriantumr]] and [[Shiz]], although [[HawkOnFire]]'s implementation is also available now and it is just as effective and maybe slightly more basic.  There are two basic parts to [[MinimumRiskMovement]]:&lt;br /&gt;
:* A Risk Function - Determines how good or bad a point is to go to.&lt;br /&gt;
:* A Point-generating function - generates candidates to try in the risk function.&lt;br /&gt;
:Then you just go to the candidate point with the lowest risk (or highest benefit, although MaximumBenefitMovement probably has more place in [[Teams]]).  Randomness can assist in either function just as effectively.  Also, as an interesting tweak, you need to decide to look for a point to go to constantly rather than only when you reach the last point you were going to.  Both strategies have merits - you might get into a rut if you keep changing your mind on points, but you can also more quickly react to changes in the battlefield.&lt;br /&gt;
&lt;br /&gt;
; [[1-vs-1]] Movement&lt;br /&gt;
: If your bot is good at close combat, you might consider chasing one robot at a time with that movement.  Chances are that if you are close to one robot, you're far from others (because who's going to go running towards two other robots?)  [[DoctorBob]] is very successful in this, and it's also one of the reasons [[Tracker]] doesn't do too bad in a battlefield full of sample bots at least.&lt;br /&gt;
&lt;br /&gt;
=== Things to think about in your movement ===&lt;br /&gt;
; Being far away from other bots&lt;br /&gt;
: This one of the easier things to test for, of course, once bots are so far away, it doesn't matter as much if they get further.  That's why using the inverse square of the distance to each robot works so well (the threat approaches zero at some point).  This will likely keep you out of the action.&lt;br /&gt;
&lt;br /&gt;
; Moving perpendicularly/one-on-one-like to other bots&lt;br /&gt;
: Especially bots that are close to you.&lt;br /&gt;
&lt;br /&gt;
; Don't hit walls or other bots too much&lt;br /&gt;
: It might be tempting ;-) This is possibly a bigger deal in melee, just because you're going to be close to other bots and to the walls alot more than in one-on-one.&lt;br /&gt;
&lt;br /&gt;
; Stay out of the middle&lt;br /&gt;
: People always say this, but in reality it's ok to be in the middle if the battle is still big and all the other bots are on the outside.  However, if you're still in the middle with 4 or 5 bots left, you won't likely last long.&lt;br /&gt;
&lt;br /&gt;
; Don't stay in the same place for too long&lt;br /&gt;
: Just as in 1-on-1, this can be quick death.  I don't care how great that spot is, someone will get close enough to it to put you in danger in not too much time.&lt;br /&gt;
&lt;br /&gt;
; Battle dynamics change constantly&lt;br /&gt;
: Be capable of adjusting and changing quickly, and don't try to plan too far into the future.&lt;br /&gt;
&lt;br /&gt;
=== Guess who will fire at you ===&lt;br /&gt;
''Note - This is a little more advanced of a topic in melee movement, and it's a little hard to explain clearly, but it's also not impossibly hard to implement.  It's also the main secret of the movement in [[Coriantumr]] and [[Shiz]].  [[FloodHT]] does it as well, but its point-generating function is bad, so it doesn't really matter :-p  I'm not sure if anyone has really tried too hard to do this before.''&lt;br /&gt;
&lt;br /&gt;
Looking at the list of ways one could pick a target, the one you have the most potential control over is whether you're the closest target for any other bot.  If I want to pick which point is the best one to be at, a big part of that is counting for each bot how many other bots are closer to them than me.  If 0 or 1 bot is closer to that robot than it is to me, that means it's likely to be aiming at me.  Combine that with the possible knowledge that that bot has hit you recently, or that you're shooting at that robot, you have a pretty good guess as to whether that bot is likely to be firing at you if you were (or are) at that point.&lt;br /&gt;
&lt;br /&gt;
There are at least two applications of this information:&lt;br /&gt;
# You want to be at the point where the fewest robots will target you.&lt;br /&gt;
# You only have to worry about being hard to hit to the robots that are likely to target you (in other words, the direction you move in to get to a given point only matters relative to bots that are likely to target either that point or your current location).&lt;br /&gt;
&lt;br /&gt;
== Little melee tweaking notes ==&lt;br /&gt;
A few things that might just get you up a few spots in the rankings:&lt;br /&gt;
&lt;br /&gt;
=== Melee radar ===&lt;br /&gt;
''For Implementations see: [[Radar#Melee_radars]]''&lt;br /&gt;
&lt;br /&gt;
What you do with your radar really depends on what your targeting strategy is, and whether or not you want to fire blind (firing blind means you don't fire when you can actually see your enemy, but rather in your general run loop or something).  If you just spin your radar constantly, you almost need to fire blind, otherwise your gun won't have time to turn before you fire.  However, I find (again, if your gun doesn't depend on a spinning radar, like some melee pattern-matchers do) that firing blind reduces my hit rate by a little.  I suggest (particularly if you're using a guess-factor gun in melee) using a melee radar lock, which is a trick I learned from [[PaulEvans]] (so it must work!)  A melee radar lock is spinning your radar until you're getting close to firing, and then lock on your target as if they were the only bot on the field for a couple ticks until you fire.  Plus, if you have a radar lock in your code, you can also use it for one-on-one :-)&lt;br /&gt;
&lt;br /&gt;
=== Melee firepower ===&lt;br /&gt;
Alot of hitting happens early in a melee match, but by the end you can be pretty well drained of energy.  Some people take the survivalistic element of melee to mean they should always fire low-powered bullets.  This is only partly true - you will likely start the melee battle close to other bots.  So close, in fact, that you are very likely rack up alot of hits (either for or against you) in the first 5 seconds of a match.  Don't be shy about firing bullets that are more than powerful enough to finish a bot off if they're really close to you (because you still want to finish them off if they hit you or someone else before your bullet reaches them, and if you're REALLY close, that's likely to happen).  I've seen some smaller melee bots (I think [[Graviton]] and [[Troodon]] were two of them) that even multiply their firepower by getOthers().  I also think that you shouldn't make the mistake of having too &amp;quot;merciful&amp;quot; of firepower in the final stages of the battle (meaning you should be aiming to kill when you're shooting at a low-energy target at any point of the battle).&lt;br /&gt;
&lt;br /&gt;
=== Picking a target ===&lt;br /&gt;
There are so many heuristics that can be dreamed up for this, but one of the easiest and most effective is to simply target the closest enemy.  While this is the best ''general'' guideline, it might be beneficial to take a few other things into consideration:&lt;br /&gt;
&lt;br /&gt;
''Who has the lowest energy?''  There are a few reasons you might want to target them:&lt;br /&gt;
* To get the kill bonus.&lt;br /&gt;
* If they are at least sort of close to you, and they are in a &amp;quot;safer&amp;quot; part of the battlefield, you might be able to take their place if they die :-)  If your movement allows you to get closer to robots with lower energy, you might be more likely to do this.&lt;br /&gt;
* So you can outsurvive them!  You get something like 100 points for every bot you outlast in a round.  You'd hate to see a robot that had 5 energy when you had 60 end up dying after you because no one shot at it when you could have.&lt;br /&gt;
* If you have a good risk function your bot will attack a low energy bot in case it has a good position on the field so that your bot will get there (important if there are around 4 to 6 bots left).&lt;br /&gt;
&lt;br /&gt;
''Who keeps shooting at you?''  There are two ways to avoid getting shot at - get them to shoot at someone else, or take them out.  Yes, killing someone can help you conserve energy!&lt;br /&gt;
&lt;br /&gt;
Try not to thrash between enemies too much, especially when you're ready to fire.  If you're only using distance to pick a target, try only switching targets if the new target is 100 pixels closer, or 10% closer, or something.  If you have some other kind of &amp;quot;score&amp;quot; technique to picking a target, something similar could be used.  Thrashing can cost you, especially early in a battle.  Another good technique is to not switch targets if your gun is almost cool (unless your target is dead, of course).&lt;br /&gt;
&lt;br /&gt;
There's a theory that the reason you pick the robot closest to you is because you're more likely to hit them.  If you're more likely to hit someone else, maybe you should shoot at them.  Of course, don't forget the advantages of having only low-energy (or dead!) bots close to you.&lt;br /&gt;
&lt;br /&gt;
== Enemy management ==&lt;br /&gt;
If you're trying to convert a 1-on-1 bot to a melee bot, you'll find out quickly that all the little assumptions you used to make when you coded your 1-on-1 bot are wrong.  It can be a big challenge to effectively store volatile information about your enemy (like current position, heading, velocity, etc) as well as persistent information about your enemy (like targeting information).  One of the big challenges is how to specify that a given enemy is dead.  I stumbled on a great way to do this when I was working on [[Coriantumr]], which was to have an volatile object (class EnemyInfo) in a Map that has position, heading, velocity, and all the obvious stuff in it, as well as a list of waves (note - all these things ''should'' go away between rounds).  This map doesn't have to be static (although it probably is for codesize reasons), because it's recreated every round.  In onScannedRobot, I check to see if the robot I'm scanning is in the map, and if it isn't, I put it in there.  Then I get the EnemyInfo object and operate on it all over onScannedRobot.  onRobotDeath removes that robot's object from the map if they exist (so the robot no longer exists when I don't care about it anymore).  Meanwhile, I have a different map which maps the name to the guess factor stats which is static and isn't reinitialized between rounds.&lt;br /&gt;
&lt;br /&gt;
== Targeting algorithms in melee ==&lt;br /&gt;
=== [[HeadOnTargeting]] in melee ===&lt;br /&gt;
Always a good place to start.  On a related note, I've heard of melee targeting which targets the rolling average of the robot's position, since it is common for a robot to stay near the same place for awhile.  Not sure how this really compares in general to just firing right at the target.&lt;br /&gt;
&lt;br /&gt;
=== [[LinearTargeting]]/[[CircularTargeting]] and variants ===&lt;br /&gt;
You can go far with some kind of percent-of-linear targeting, or using circular targeting in melee.  It has been observed that if you are close to an enemy, you have really good odds firing with linear targeting, and if they're further away (say moving around in a corner or something), you have pretty good odds with head-on or somewhere near that.  Take a look at [[Infinity]] for a really elegant solution to this observation.  Another thing that might work well is velocity-averaging.  Some more observations could certainly be collected to create a generally good melee gun that is simple to understand and code and is *very* resiliant to missed scans.&lt;br /&gt;
&lt;br /&gt;
=== [[PatternMatching]] in melee ===&lt;br /&gt;
Be careful to make your targeting algorithm resistant to not having constant scans.  If you spin your radar, you will get a scan on a given robot every 8 ticks on average.  Occasionally (ok, actually somewhat often), you'll scan a bot two ticks in a row, and that should throw your targeting off.  Often, you'll scan the robot again after 7 or 9 ticks.  If your targeting algorithm absolutely requires scans every 8 ticks, you'll have to make it realize that the world isn't perfect.  In my opinion, pattern-matching has been slowly becoming obselete in one-on-one in its purest form (note that there are ways of making it last in the realm of random movement), but is still definitely alive and kicking in the melee world, if only because melee isn't as well developed.&lt;br /&gt;
&lt;br /&gt;
=== [[GuessFactorTargeting]] in melee ===&lt;br /&gt;
[[FloodMini]] from the start has had a wave implementation that was really good about missed scans, mainly because its radar was far from perfect.  The same idea is in [[Coriantumr]]'s gun, which is to interpolate missed scans linearly and check at each interpolated position/time if the wave hits.  This is probably the trickies part, along with how to store the waves (see the Enemy Management section above).  In general in melee, you're pretty safe firing a wave on every scan of a robot, not just when you fire at them, but realize that robots might be moving different relatively to you if you're not shooting at them (or likely to shoot at them anwyays).  Segmenting on distance and possibly battle size can help compensate for this problem, as well as segmenting on lateral direction (are they moving roughly perpendicular to you, toward you, or away from you?)  Acceleration segmentation can be a little harder to do in melee, since you aren't getting consecutive scans for all of your waves, but I've observed that if the sign of the enemy's velocity is opposite of the previous scan, they're probably accelerating (unless they are already at velocity 8).&lt;br /&gt;
&lt;br /&gt;
Also, I recommend using a melee radar lock for [[GuessFactorTargeting]] (see Melee Radar above).&lt;br /&gt;
&lt;br /&gt;
For any of these techniques, you should consider making sure you don't fire off the battlefield at a or in a direction that can't possibly be reached by your target.  This sounds obvious, but I don't know how many times I've seen a robot aiming at another robot that was moving toward a wall, and the shooting robot just shot right into the wall, which is a complete waste of a shot.  This is one of the improvements I made in [[Coriantumr]] from 1.0 to 1.1.&lt;br /&gt;
&lt;br /&gt;
== Evaluating your Melee bot ==&lt;br /&gt;
Before I get too far into this, I want to emphasize that the number one way of figuring out where you can improve is by critically watching the battles. The first thing to do is to create a test bed.  Find a bunch of bots that are at least in the same neighborhood as you as far as ability, some better and some worse.  I also make a text file where I log battles and what tweaks I made between them.  Of course, don't give too much credit to the scores, since they often vary wildly. If you start to beat your test bed consistently, upgrade it.&lt;br /&gt;
&lt;br /&gt;
It is a good idea to keep track of how long you're staying alive.  I like to add this code into my bot for testing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//global declarations:&lt;br /&gt;
static int[] finishes;&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
//beginning of run():&lt;br /&gt;
if (finishes == null)&lt;br /&gt;
	finishes = new int[getOthers()+1];&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
.&lt;br /&gt;
//somewhere:&lt;br /&gt;
public void onWin(WinEvent e){onDeath(null);}&lt;br /&gt;
public void onDeath(DeathEvent e)&lt;br /&gt;
{&lt;br /&gt;
	finishes[getOthers()]++;&lt;br /&gt;
	for (int i=0; i&amp;lt;finishes.length; i++)&lt;br /&gt;
		out.print(finishes[i] + &amp;quot; &amp;quot;);&lt;br /&gt;
	out.println();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will print out a list of wins, 2nd places, 3rd places, etc. at the end of each match.  Obviously, you want to maximize the wins ;-)  Of course, what you want to do first is make sure this gives a regular, smooth distribution over time.  You can analyze where some of your weaknesses (relative to the stages to a melee battle at the top) by where the highest numbers are.  For instance:&lt;br /&gt;
* If you have alot of last and next-to-last finishes, maybe you don't do well at close quarters or get out of tough starting situations very well.  Try to get to the best place you can and get other bots to target each other instead of you.&lt;br /&gt;
* If you are dying alot in a part of the battle where there are still alot of bots, but it's not the beginning really, you might just need to be more random/harder to hit.  In a standard 10-bot battle, this is probably about 6th-8th place finishes.&lt;br /&gt;
* If you tend to have hugely more 5th and 6th places than 3rd and 4th, it could be you don't get out of the middle soon enough.&lt;br /&gt;
* If you have way more 3rd places than 4th or 2nd, it probably means that you're not good at getting rid of one of the guys closer to you at the end of a battle.&lt;br /&gt;
* If you have way more 2nd places than 1st, it could be that you have lower 1-on-1 strength than the other bots.  On the other hand, it could be that you're barely surviving before that.  Watch a few battles to figure it out.  I see HawkOnFire finishing off Shadow at the end quite a bit simply because it has 4 times as much energy when they get down to 1-on-1.&lt;br /&gt;
&lt;br /&gt;
Some tips:&lt;br /&gt;
&lt;br /&gt;
* Just like in 1-on-1, every tweak counts, even the tiniest change to your power management can be catastrophic or miraculous.&lt;br /&gt;
* Make up other techniques to help you test the parts of a battle that you're not as good at.  For instance:&lt;br /&gt;
** If you do well getting into the last 4, but have trouble making into the last 3, you could try tweaking in 4-bot battles, or you could try tweaking in 10-bot battles on a 2000x2000 battlefield (which might have a similar strategic effect).  This can also expose what your bot does if it can't see anyone (which only rarely happens on a 1000x1000 battlefield, probably only when it gets down to 1-on-1).&lt;br /&gt;
** If you have an abnormal amount of last place finishes, you could try testing on a point-blank melee (10 bots on 400x400?  That's just like doing the start of a battle for the whole battle).  If you try that with today's top melee bots, you'll find that [[Coriantumr]] and bots with iterations of his movement are the best at this, hands down (let me know if you can find anyone who can beat it).  Again, this also might expose some of the other problems you have with your movement that make your bot too specialized (or just less versatile).&lt;br /&gt;
** If it's that stage between the beginning and half way that gets you down, the point-blank melee thing can also help.  Try even upping the stakes and see how you perform at close range (say 20 bots on a 400x400 battlefield.  This can be pretty funny to watch).&lt;br /&gt;
* You might want to delete saved data if you test with bots that save data to disk ([[SandboxDT]] or [[SandboxLump]], for instance).&lt;br /&gt;
* If you're looking at your [[RoboRumble]] problem bots, realize that some of them might be a problem bot for you because they do better against lots of other bots than you do, not because they're a direct problem for you.  Also, PBI's are deceptively low in melee, because there are 8 other bots in every battle who affect the performance for each of you.&lt;br /&gt;
* '''''WATCH YOUR BOT.''''' Get a feeling for your bot's behavior. Worked fine for [[Aleph]].&lt;br /&gt;
* Make a battle with 10 of your bot. If the scores are somewhat similar, that's good. If the scores are hugely different, luck might play a factor in your bot's score. You might want to tweak a little bit in that case.&lt;br /&gt;
&lt;br /&gt;
== Understanding Bots ==&lt;br /&gt;
I think we should add a few tutorials or in-depth descriptions of a few good melee bots (especially the open-source flavor).  Maybe a few pages like:&lt;br /&gt;
* [[/UnderstandingCoriantumr]]&lt;br /&gt;
* [[/UnderstandingHawkOnFire]]&lt;br /&gt;
* [[/UnderstandingGruweltje]]&lt;br /&gt;
* [[/UnderstandingNimrod]]&lt;br /&gt;
* [[/UnderstandingInfinity]]&lt;br /&gt;
* [[/UnderstandingLib]]&lt;br /&gt;
* [[/UnderstandingTroodon]]&lt;br /&gt;
* [[/UnderstandingDoctorBob]]&lt;br /&gt;
These can be filled in by the authors or anyone else who has taken time to understand them (or feel free to describe your own).&lt;br /&gt;
&lt;br /&gt;
[[Category:Strategy]]&lt;br /&gt;
[[Category:Melee]]&lt;/div&gt;</summary>
		<author><name>Bostonvaulter</name></author>
		
	</entry>
	<entry>
		<id>http://robowiki.net/w/index.php?title=GITS/Targeting/Source&amp;diff=16110</id>
		<title>GITS/Targeting/Source</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=GITS/Targeting/Source&amp;diff=16110"/>
		<updated>2010-05-09T09:48:29Z</updated>

		<summary type="html">&lt;p&gt;Bostonvaulter: removing source code category since this currently doesn't have any source code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''GITS Targeting (Source)''' - from version 0.5-051509&lt;br /&gt;
----&lt;br /&gt;
I took down the source because I'm going to rewrite the GhostGun using classes to extend the plug-ability. I will post that when I get a (most likely horrible) working version.&lt;/div&gt;</summary>
		<author><name>Bostonvaulter</name></author>
		
	</entry>
	<entry>
		<id>http://robowiki.net/w/index.php?title=Radar&amp;diff=15858</id>
		<title>Radar</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=Radar&amp;diff=15858"/>
		<updated>2010-04-25T03:49:17Z</updated>

		<summary type="html">&lt;p&gt;Bostonvaulter: /* Gun Heat Lock */ Made it more clear that it is checking if this robot has low gun heat&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Radar''' is one of the most vital components of your robot. Without it, [[targeting]] is effectively impossible and [[movement]] is purely random. Just as with movement and targeting, there are many simple and complex algorithms for radar control. In most robots the radar takes up the smallest portion of code.&lt;br /&gt;
&lt;br /&gt;
[[Image:Radar.jpg|thumb|right|300px|Radar in [[Robocode]]]]&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
A radar in Robocode can turn a maximum of 45° or &amp;amp;pi;/4&amp;lt;sup&amp;gt;rad&amp;lt;/sup&amp;gt; in a single tick. The radar scans robots up to 1200 units away. The angle that the radar rotates between two ticks creates what is called a radar arc, and every robot detected within the arc is sent to the &amp;lt;code&amp;gt;onScannedRobot()&amp;lt;/code&amp;gt; method in order of distance from the scanning bot. The closest bot is detected first, while the furthest bot is detected last. By default, the &amp;lt;code&amp;gt;onScannedRobot()&amp;lt;/code&amp;gt; method has the lowest [[event priority]] of all the event handlers in Robocode, so it is the last one to be triggered each tick.&lt;br /&gt;
&lt;br /&gt;
== 1-vs-1 Radars ==&lt;br /&gt;
1-vs-1 radars are the smallest of the bunch and many can get a scan in every turn, producing a perfect lock.&lt;br /&gt;
&lt;br /&gt;
=== Spinning radar ===&lt;br /&gt;
A simple spin of the radar, this is very ineffective in one on one, but still used in [[NanoBot]]s.&lt;br /&gt;
&lt;br /&gt;
Here is an example of this type of radar:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public void run() {&lt;br /&gt;
    // ...&lt;br /&gt;
&lt;br /&gt;
    do {&lt;br /&gt;
        turnRadarRightRadians(Double.POSITIVE_INFINITY);&lt;br /&gt;
    } while (true);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The infinity lock ===&lt;br /&gt;
The infinity lock is the simplest radar lock and it is used frequently in [[NanoBots]]. It has the disadvantage of &amp;quot;slipping&amp;quot; and losing its lock frequently. But is a much better alternative to the Spinning radar in one on one combat.&lt;br /&gt;
&lt;br /&gt;
Here is an example of this type of radar:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public void run() {&lt;br /&gt;
    // ...&lt;br /&gt;
    turnRadarRightRadians(Double.POSITIVE_INFINITY);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public void onScannedRobot(ScannedRobotEvent e) {&lt;br /&gt;
    // ...&lt;br /&gt;
    setTurnRadarLeftRadians(getRadarTurnRemainingRadians());&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Perfect radar locks ===&lt;br /&gt;
There are several &amp;quot;perfect&amp;quot; radar locks that will not slip once they have a lock.&lt;br /&gt;
&lt;br /&gt;
==== Narrow lock ====&lt;br /&gt;
Point the radar at the enemy's last known location. This results in a thin beam which follows the enemy around the battlefield. Many recent one on one bots use this type of radar. This radar lock is similar to, and considered an enhancement on the wide radar lock described below.&lt;br /&gt;
&lt;br /&gt;
If implemented correctly, it is not possible for the enemy escape this lock. A robot's width is 36px (that's 18px from the middle) and it can only move at up to 8px/turn, so if your beam is pointing at its centre, it won't be able to move entirely out of it in one turn. However, a robot will only automatically scan for enemies if its radar is turning, which might not happen if you are using a Narrow Lock and your enemy decides to stay still for 2 turns. For this reason, if you decide to use an unmultiplied Narrow Lock, you must call &amp;lt;code&amp;gt;scan()&amp;lt;/code&amp;gt; yourself to avoid losing lock. Furthermode, if you skip turns, your enemy might be able to move out from your radar beam before you recover.&lt;br /&gt;
&lt;br /&gt;
To overcome these issues, a Narrow Lock is often multiplied by a factor (as described below) to keep the radar moving and ensure the enemy does not escape the scan arc.&lt;br /&gt;
&lt;br /&gt;
Here is an example of this kind of radar:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import robocode.util.Utils;&lt;br /&gt;
&lt;br /&gt;
public void run() {&lt;br /&gt;
    // ...&lt;br /&gt;
&lt;br /&gt;
    turnRadarRightRadians(Double.POSITIVE_INFINITY);&lt;br /&gt;
    do {&lt;br /&gt;
        // Check for new targets.&lt;br /&gt;
        // Only necessary for Narrow Lock because sometimes our radar is already&lt;br /&gt;
        // pointed at the enemy and our onScannedRobot code doesn't end up telling&lt;br /&gt;
        // it to turn, so the system doesn't automatically call scan() for us&lt;br /&gt;
        // [see the javadocs for scan()].&lt;br /&gt;
        scan();&lt;br /&gt;
    } while (true);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public void onScannedRobot(ScannedRobotEvent e) {&lt;br /&gt;
    double radarTurn =&lt;br /&gt;
        // Absolute bearing to target&lt;br /&gt;
        getHeadingRadians() + e.getBearingRadians()&lt;br /&gt;
        // Subtract current radar heading to get turn required&lt;br /&gt;
        - getRadarHeadingRadians();&lt;br /&gt;
&lt;br /&gt;
    setTurnRadarRightRadians(Utils.normalRelativeAngle(radarTurn));&lt;br /&gt;
&lt;br /&gt;
    // ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following factors affect the behaviour in the following ways (eg. &amp;lt;code&amp;gt;factor * Utils.normalRelativeAngle(radarTurn)&amp;lt;/code&amp;gt;)&lt;br /&gt;
* 1.0 - Thin radar lock. Must call scan() to avoid losing lock. God help you if you ever skip a turn.&lt;br /&gt;
* 1.9 - Radar arc starts wide and slowly narrows as much as possible while staying on target.&lt;br /&gt;
* 2.0 - Radar arc sweeps through a fixed angle. Exact angle chosen depends on positions of enemy and radar when enemy is first picked up. Angle will be increased if necessary to maintain a lock. Most used corrective factor.&lt;br /&gt;
&lt;br /&gt;
==== Wide lock ====&lt;br /&gt;
The Wide Radar Lock tries to scan a fixed distance to either side of the enemy. It was to the best of knowledge created before the Narrow Radar Lock. Its constant motion means the radar will not slip as long as you don't miss any turns.&lt;br /&gt;
&lt;br /&gt;
Here is an example of this type of radar:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import robocode.util.Utils;&lt;br /&gt;
&lt;br /&gt;
public void run() {&lt;br /&gt;
    // ...&lt;br /&gt;
&lt;br /&gt;
    do {&lt;br /&gt;
        // ...&lt;br /&gt;
        if (getRadarTurnRemaining() == 0.0)&lt;br /&gt;
            setTurnRadarRightRadians(Double.POSITIVE_INFINITY);&lt;br /&gt;
        execute();&lt;br /&gt;
    } while (true);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public void onScannedRobot(ScannedRobotEvent e) {&lt;br /&gt;
    double radarTurn = Utils.normalRelativeAngle(&lt;br /&gt;
        // Absolute bearing to target&lt;br /&gt;
        getHeadingRadians() + e.getBearingRadians()&lt;br /&gt;
        // Subtract current radar heading to get turn required&lt;br /&gt;
        - getRadarHeadingRadians() );&lt;br /&gt;
&lt;br /&gt;
    // Distance we want to scan from middle of enemy to either side&lt;br /&gt;
    double extraTurn = Math.min(Math.atan(36.0 / e.getDistance()), Math.PI/4.0);&lt;br /&gt;
&lt;br /&gt;
    setTurnRadarRightRadians(radarTurn + (radarTurn &amp;lt; 0 ? -extraTurn : extraTurn));&lt;br /&gt;
&lt;br /&gt;
    // ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;lt;code&amp;gt;36.0&amp;lt;/code&amp;gt; with any distance you want covered.&lt;br /&gt;
&lt;br /&gt;
== Melee radars ==&lt;br /&gt;
Melee radars are more complex and take up considerable more room inside a robot. Since the field of opponents does not usually fall within a 45° area, compromises must be made between frequent data of one bot (e.g., the firing target) and consistently updated data of all bots.&lt;br /&gt;
&lt;br /&gt;
=== Spinning radar ===&lt;br /&gt;
Just as with one on one, there is the generic spinning radar. This is the most used melee radar as it is by far the easiest to implement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public void run() {&lt;br /&gt;
    // ...&lt;br /&gt;
&lt;br /&gt;
    while(true) {&lt;br /&gt;
        turnRadarRightRadians(Double.POSITIVE_INFINITY);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Corner Arc ====&lt;br /&gt;
A variation on the spinning radar, if the robot is in a corner it scans back and forth across the 90 degree arc away from the corner, as not to waste time scanning where there cannot be any robots. Typically, this is used only in smaller melee robots, which do not have room for a more complicated radar system. Melee bots with room tend to use one of the implementations below.&lt;br /&gt;
&lt;br /&gt;
=== Oldest Scanned ===&lt;br /&gt;
This type of melee radar spins towards the robot it hasn't seen in the longest amount of time. Here is an example of this type of radar.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.util.*;&lt;br /&gt;
import robocode.*;&lt;br /&gt;
import robocode.util.*;&lt;br /&gt;
&lt;br /&gt;
// ... Within robot class&lt;br /&gt;
&lt;br /&gt;
static LinkedHashMap&amp;lt;String, Double&amp;gt; enemyHashMap;&lt;br /&gt;
static double scanDir;&lt;br /&gt;
static Object sought;&lt;br /&gt;
&lt;br /&gt;
public void run() {&lt;br /&gt;
    scanDir = 1;&lt;br /&gt;
    enemyHashMap = new LinkedHashMap&amp;lt;String, Double&amp;gt;(5, 2, true);&lt;br /&gt;
&lt;br /&gt;
    // ...&lt;br /&gt;
&lt;br /&gt;
    while(true) {&lt;br /&gt;
        setTurnRadarRightRadians(scanDir * Double.POSITIVE_INFINITY);&lt;br /&gt;
        scan();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public void onRobotDeath(RobotDeathEvent e) {&lt;br /&gt;
    enemyHashMap.remove(e.getName());&lt;br /&gt;
    sought = null;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public void onScannedRobot(ScannedRobotEvent e) {&lt;br /&gt;
    String name = e.getName();&lt;br /&gt;
    LinkedHashMap&amp;lt;String, Double&amp;gt; ehm = enemyHashMap;&lt;br /&gt;
&lt;br /&gt;
    ehm.put(name, getHeadingRadians() + e.getBearingRadians());&lt;br /&gt;
&lt;br /&gt;
    if ((name == sought || sought == null) &amp;amp;&amp;amp; ehm.size() == getOthers()) {&lt;br /&gt;
	scanDir = Utils.normalRelativeAngle(ehm.values().iterator().next()&lt;br /&gt;
            - getRadarHeadingRadians());&lt;br /&gt;
        sought = ehm.keySet().iterator().next();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
With above code, the radar will spin past every bot, and then reverse it's direction until its passed all bots, then repeat. If  the spin takes more than 4 ticks, the radar will continue spinning like the spinning radar above. This kind of radar is used in many top bots include Shadow and Phoenix. This kind of radar should be used unless you need a melee radar lock or your targeting system requires you to have enemy scans every 8 ticks.&lt;br /&gt;
&lt;br /&gt;
=== Gun Heat Lock ===&lt;br /&gt;
A technique developed by [[Paul Evans]]/[[Kawagi]] for [[SandboxDT]]/[[FloodHT]]. This radar locks onto a target when this robot has low gunheat. Normally this is best for melee robots which use GuessFactor Targeting.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
public void run() {&lt;br /&gt;
    // ...&lt;br /&gt;
    setTurnRadarRightRadians(Double.POSITIVE_INFINITY);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public void onScannedRobot(ScannedRobotEvent e) {&lt;br /&gt;
    // ... your own target selection&lt;br /&gt;
    double absoluteBearing = getHeadingRadians() + e.getBearingRadians();&lt;br /&gt;
    if (isCurrentTarget &amp;amp;&amp;amp; getGunHeat() &amp;lt; 0.5) { // Lock for 5 ticks&lt;br /&gt;
        setTurnRadarRightRadians(3.5 * Utils.normalRelativeAngle(absoluteBearing - getRadarHeadingRadians()));&lt;br /&gt;
    else&lt;br /&gt;
        setTurnRadarRightRadians(Double.POSITIVE_INFINITY); &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
The code above uses a Narrow Lock but the simpler Infinity Lock works just as well. For a narrow lock, it is recommended you multiply by a large factor to continue scanning other robots while locked.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
For most of these radar locks, you will need to add one of the following to your &amp;lt;code&amp;gt;run()&amp;lt;/code&amp;gt; method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
setAdjustRadarForRobotTurn(true);&lt;br /&gt;
setAdjustGunForRobotTurn(true);&lt;br /&gt;
setAdjustRadarForGunTurn(true);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Code Snippets]]&lt;br /&gt;
[[th:เรดาร์]]&lt;/div&gt;</summary>
		<author><name>Bostonvaulter</name></author>
		
	</entry>
	<entry>
		<id>http://robowiki.net/w/index.php?title=Robocode/FAQ&amp;diff=15551</id>
		<title>Robocode/FAQ</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=Robocode/FAQ&amp;diff=15551"/>
		<updated>2010-04-07T09:41:32Z</updated>

		<summary type="html">&lt;p&gt;Bostonvaulter: /* Installing and using */ fixed numbering issue&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Frequently asked questions about Robocode.&lt;br /&gt;
&lt;br /&gt;
== [[Robocode/Download|Installing]] and [[Robocode/Getting Started|using]] ==&lt;br /&gt;
&lt;br /&gt;
; '''I can't install Robocode.'''&lt;br /&gt;
: First make sure you have [[Robocode/System_Requirements|Java installed]] on your computer. To check it, run the command: &amp;lt;code&amp;gt;java -version&amp;lt;/code&amp;gt; It should execute and show a version 1.5 or higher. If not, go to Sun site and download the last version. After, make sure you have downloaded the correct file (&amp;lt;code&amp;gt;robocode-setup-X.X.X.jar&amp;lt;/code&amp;gt;, where &amp;lt;code&amp;gt;X.X.X&amp;lt;/code&amp;gt; is the version number). Execute the file by double-clicking on it, or if you want to do it manually, execute the following command: &amp;lt;code&amp;gt;java -jar robocode-setup-X.X.X.jar&amp;lt;/code&amp;gt;. It will launch an installer that will install Robocode. The installer creates the icons to execute Robocode, but you can execute it manually by running the &amp;lt;code&amp;gt;robocode.bat&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;robocode.sh&amp;lt;/code&amp;gt; file in the &amp;lt;code&amp;gt;/robocode&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
; '''I have downloaded a robot from the Web, but I don't know how to use it, because it doesn't appear anywhere.'''&lt;br /&gt;
: By default, robots are read from the &amp;lt;code&amp;gt;/robocode/robots&amp;lt;/code&amp;gt; directory. You can select &amp;quot;Robot -&amp;gt; Import Downloaded Robot&amp;quot; to copy a robot JAR to this directory from another location. Also, you can configure Robocode to read robots from additional locations using the Properties dialog.&lt;br /&gt;
&lt;br /&gt;
; '''What do I have to do to see the source code of a robot?'''&lt;br /&gt;
: You can do two things. The first option is to open the Editor Window in Robocode and use the command in the File menu. The second option is to open the robot &amp;quot;.jar&amp;quot; file with a zip utility and find the source code there (assuming, of course, the robot is open source).&lt;br /&gt;
&lt;br /&gt;
; '''Can I play Robocode online?'''&lt;br /&gt;
: Robocode is not an &amp;quot;online&amp;quot; game, so you can't, for example, share a battle with your friends in real time over the Internet. But you can upload your bots to places like [http://sites.google.com/ Google Sites] or [[RobocodeRepository|Robocode Repository]] and join any of the [[:Category:Competitions|existing competitions]] such as [[RoboRumble@Home]], or organize one with your friends.&lt;br /&gt;
&lt;br /&gt;
; '''I have seen that many bots are packaged into &amp;quot;.jar&amp;quot; files. How do I package my bot?'''&lt;br /&gt;
: Select, &amp;quot;Robot --&amp;gt; Package robot for upload&amp;quot; from the menu, then enter your robot's details when prompted.&lt;br /&gt;
&lt;br /&gt;
;''' When I test my bots, Robocode is slow. Is there a way to execute the battles faster?'''&lt;br /&gt;
: When you are testing your robot, you want to execute many battles in a short time. Minimize the Robocode main screen to make it execute the battles at full speed.&lt;br /&gt;
&lt;br /&gt;
; '''I get this error when trying to start Robocode: &amp;quot;'JAVA' is not recognized as an internal or external command, operable or batch file&amp;quot;'''&lt;br /&gt;
:&lt;br /&gt;
:# Find where you installed Java. The default position at: &amp;lt;code&amp;gt;C:\Program Files\Java\jre6\bin&amp;lt;/code&amp;gt; &lt;br /&gt;
:#: Yeah, find the path to the bin directory in the java directory.  &lt;br /&gt;
:# Copy all that.  &lt;br /&gt;
:# Right click on My Computer and select Properties. The System dialogue should have appeared. On Vista, choose &amp;quot;Advanced system settings&amp;quot; in the sidebar. On XP, choose 'Advanced' tab. &lt;br /&gt;
:# Now, click on &amp;quot;Environmental Variables&amp;quot; which is a button at the bottom right. &lt;br /&gt;
:# Under the category &amp;quot;System variables&amp;quot; which is the lower box, scroll down to &amp;quot;Path&amp;quot; and double click on it. &lt;br /&gt;
:# In &amp;quot;Variable value&amp;quot;, go to the end of all that text and paste in the path of your java\bin directory. The one you copied earlier. Then put a semicolon &amp;lt;code&amp;gt;;&amp;lt;/code&amp;gt; Here's what my Path value looks like: &amp;quot;set PATH=%PATH%%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Java\jre6\bin;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== [[Robocode/Game Physics|Game physics]] ==&lt;br /&gt;
&lt;br /&gt;
; '''What is the difference between frames and ticks?'''&lt;br /&gt;
: A tick refers to one unit, which is also called a Turn in Robocode. During one turn, you may perform one action as a Robot, or multiple (independent) actions as an AdvancedRobot. A frame is a unit of drawing to the Robocode client interface. If you are processing turns slowly, you will get one frame per tick / turn. However, if you up the turns per second beyond your computer's ability to render the frames, you will miss some frames of animation. This won't affect the robots' behavior, unless you foolishly added code in your &amp;lt;code&amp;gt;onPaint(Graphics2D)&amp;lt;/code&amp;gt; method that alters your bots behavior. In that case, your bot will behave differently depending on whether or not the Paint button has been enabled, and if the framerate can keep up with the turnrate.&lt;br /&gt;
&lt;br /&gt;
; '''Can I fire bullets with power higher than 3.0 or lower than 1.0?'''&lt;br /&gt;
:No and yes. You can't fire bullets with power greater than 3.0, but you can fire bullets with power as low as 0.1. If you call a firing function (i.e. &amp;lt;code&amp;gt;setFire()&amp;lt;/code&amp;gt;) with a value greater than 3.0, Robocode will adjust it to 3.0, and if you call it with a power lower than 0.1 (except 0.0 which will not fire) it will adjust it to 0.1. Additionally, you can fire bullets with power less than 0.1 under one condition: when your robot has less than 0.1 energy left, in which case a bullet is fired with however much energy your robot had left.&lt;br /&gt;
&lt;br /&gt;
; '''How fast does a bullet travel?'''&lt;br /&gt;
:A bullet travels at a speed between 11.0 and 19.7 depending on the power. The more powerful the bullet, the slower. The formula to calculate it is &amp;lt;code&amp;gt;velocity = 20 - (3 * power)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; '''Does the robot velocity get added to the bullet velocity on firing?'''&lt;br /&gt;
: No, bullet velocity is not affected by robot velocity. It's kind of like the speed-of-light thing. =)&lt;br /&gt;
&lt;br /&gt;
; '''Which is the range of a bullet?'''&lt;br /&gt;
: A bullet has no range. It keeps going until it hits a robot or a wall.&lt;br /&gt;
&lt;br /&gt;
; '''I want to fire a bullet every turn, but I can't. Why?'''&lt;br /&gt;
: Every time you fire, the gun generates some heat. You must wait till it is cool again to fire. If you give a fire order when your gun is hot, it will do nothing. The heat generated by a shot is &amp;lt;code&amp;gt;1 + (firepower / 5)&amp;lt;/code&amp;gt;. The gun cools down at a default rate of 0.1 per turn (note that you can change this parameter when you run the battle, but nobody usually does). It means you can fire a 3.0 power bullet every 16 ticks.&lt;br /&gt;
&lt;br /&gt;
; '''How much damage does a bullet do? How do I gain or lose energy?'''&lt;br /&gt;
: You lose energy every time you hit a wall, you are hit by an enemy bullet, ram an enemy, or you fire your gun. The amount of energy you lose by being hit is &amp;lt;code&amp;gt;4 * bullet power + 2 * max(bullet power - 1 , 0)&amp;lt;/code&amp;gt;. So the maximum amount is 16.0. When you fire, you spend a quantity of energy equal to the power of the bullet fired. When one of your bullets hits an enemy, you collect back &amp;lt;code&amp;gt;3 * bullet power&amp;lt;/code&amp;gt; energy. When you hit an enemy bot, each bot takes 0.6 damage. If an [[AdvancedRobot]] (but not a [[Robot]] or [[JuniorRobot]]) hits a wall, it will take &amp;lt;code&amp;gt;max(abs(velocity) * 0.5 - 1, 0)&amp;lt;/code&amp;gt; damage.&lt;br /&gt;
&lt;br /&gt;
; '''Some times I get disabled. What happens?'''&lt;br /&gt;
: You can't kill yourself, so when your energy drops to zero because you hit a wall or you fire, your bot gets disabled. It will not be able to move nor fire. If you are lucky enough and one of your bullets in the air hits an enemy, you will get some energy back and recover from disabled status.&lt;br /&gt;
&lt;br /&gt;
; '''I get disabled, but I my energy &amp;gt; 0. Why?'''&lt;br /&gt;
: There are a few possible causes. You may have called a getXXX() function - such as getVelocity() - too many times a turn. The limit is 10000 getXXX() function calls per turn. To avoid disabling in such situations, either store returned values in variables for future use or use a [[RobotStatus]] object obtained from [[StatusEvent]]. Another case in which you can get disabled is throwing an exception, which may disable your bot, even if you catch the exception. Also, if your bot gets stuck in an infinite (or very long) loop and skips many turns, it may also get disabled.&lt;br /&gt;
&lt;br /&gt;
; '''How fast do I move?'''&lt;br /&gt;
: You can move at a maximum speed of 8.0 units/tick. You can modify (down) your maximum velocity by using &amp;lt;code&amp;gt;setMaxVelocity(...)&amp;lt;/code&amp;gt;. Note that your bot will always accelerate to reach its maximum velocity.&lt;br /&gt;
&lt;br /&gt;
; '''How fast do I accelerate?'''&lt;br /&gt;
: You accelerate at 1 unit/tick, and you decelerate at 2 units/tick. For example, if you are moving at an speed of 8.0 and reverse your direction your velocities will be [6.0, 4.0, 2.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0].&lt;br /&gt;
&lt;br /&gt;
; '''How fast do I turn?'''&lt;br /&gt;
: The faster you go, the slower you turn. The formula to calculate it in degrees is &amp;lt;code&amp;gt;10 - 0.75 * abs(velocity)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; '''What is the size of a bot?'''&lt;br /&gt;
: The size of a bot is 36x36. Note, this is slightly smaller than the image of the bot. It is modeled as a non rotating square, so it's always the same regardless of its heading.&lt;br /&gt;
&lt;br /&gt;
; '''It seems that Robocode doesn't follow standard physics. If my velocity is 0 and I accelerate (acceleration = 1) my final velocity is 1, but it should be 0.5. What happened?'''&lt;br /&gt;
: Time in Robocode, rather than being continuous, is in discrete &amp;quot;ticks&amp;quot;. First acceleration is calculated, then velocity, and then position. So if you are stopped at a position 0 and you accelerate 1, your velocity next turn will be 1 and your position also 1.&lt;br /&gt;
&lt;br /&gt;
; '''How can I detect when an enemy has fired?'''&lt;br /&gt;
: There is no direct way to detect when an enemy fired, but you can deduce it by monitoring the enemy energy drop. A drop between 0.1 and 3 usually means that it fired a bullet (there can be other reasons, such as a low energy bullet hit or a wall hit). Wall hits are (more or less) detectable as well. A deceleration &amp;gt; 2 means the bot hit a wall (or another bot). A deceleration &amp;lt;= 2 may be simple a bot hitting the brakes, or hitting a wall at velocity = 2, but since hitting a wall at that speed won't cause any damage, you can ignore that. AdvancedRobots take &amp;lt;code&amp;gt;abs(velocity) / 2 - 1 (Never &amp;lt; 0)&amp;lt;/code&amp;gt; damage when hitting a wall, so by detecting (significant) wall-hits and adjusting the enemy drop accordingly, wall hits can be filtered out most of the time. This method fails when the enemy hits another robot.&lt;br /&gt;
&lt;br /&gt;
; '''How can I detect the position and heading of an enemy bullet?'''&lt;br /&gt;
: You can't. There is no way to know it, directly or indirectly. But of course, you can always [[GuessFactor|guess]]...&lt;br /&gt;
&lt;br /&gt;
; '''How fast can I turn my gun?'''&lt;br /&gt;
: The gun turns at 20 degrees per tick.&lt;br /&gt;
&lt;br /&gt;
; '''How fast can I turn my radar?'''&lt;br /&gt;
: It turns 45 degrees per tick.&lt;br /&gt;
&lt;br /&gt;
; '''Can I know the heading of the enemy gun/radar?'''&lt;br /&gt;
: No.&lt;br /&gt;
&lt;br /&gt;
; '''Can I specify the initial position of my bot?'''&lt;br /&gt;
: No. The bots are randomly placed in the field at the beginning of each round.&lt;br /&gt;
&lt;br /&gt;
== Programming your robot ==&lt;br /&gt;
; '''What is the difference between the setXXX() (e.g. &amp;lt;code&amp;gt;setFire()&amp;lt;/code&amp;gt;) and the XXX() (e.g. &amp;lt;code&amp;gt;fire()&amp;lt;/code&amp;gt;) methods?'''&lt;br /&gt;
: Basically, the setXXX() methods just notify Robocode to take some action at the end of the turn. The XXX()-type methods end the turn when you call them, and they block your robot's thread until the command finishes. Unless you have a good reason, you should almost always use the setXXX() version when writing [[AdvancedRobot|AdvancedRobots]].&lt;br /&gt;
&lt;br /&gt;
; '''How can I avoid my gun/radar turning when my bot turns?'''&lt;br /&gt;
: You can use &amp;lt;code&amp;gt;setAdjustGunForRobotTurn()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt; setAdjustRadarForGunTurn()&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;setAdjustRadarForRobotTurn()&amp;lt;/code&amp;gt; methods to control this. If you call &amp;lt;code&amp;gt;setAdjustGunForRobotTurn()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt; setAdjustRadarForGunTurn()&amp;lt;/code&amp;gt;, you don't need to call &amp;lt;code&amp;gt;setAdjustRadarForRobotTurn()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; '''Why are there two functions for &amp;lt;code&amp;gt;getBearing()&amp;lt;/code&amp;gt; for example - one in radians and one in degrees? Is there any performance gain if I use radians instead of degrees?'''&lt;br /&gt;
: There is no real advantage to using one or the other. Just use the one you prefer. Often, people start using degrees (just because they feel more comfortable with them) and later they switch to radians (because calculations are easier since you can use the built-in Java trigonometric functions). Just remember to use always radians or always degrees; mixing them up is not a good idea.&lt;br /&gt;
&lt;br /&gt;
; '''I need to trace my bots actions and variables. I saw that everybody uses &amp;lt;code&amp;gt;out.println(&amp;quot;...&amp;quot;)&amp;lt;/code&amp;gt;, but where is that printed?'''&lt;br /&gt;
: It prints to the [[Robocode/Robot Console|robot console]]. When you execute the battle, just click on the button on the right of the screen that shows the name of your robot to open its [[Robocode/Robot Console|console]].&lt;br /&gt;
&lt;br /&gt;
; '''How do you get your radar to stay focused on a robot that you have defined as your target?'''&lt;br /&gt;
: You just turn the radar the other way around when you scan the bot. You lock your radar by not turning it 45 degrees, but only the arc needed to stay focused. See the [[Radar]] page for some example code.&lt;br /&gt;
&lt;br /&gt;
; '''How can I know how many enemies are in the battle field?'''&lt;br /&gt;
: You can use the &amp;lt;code&amp;gt;getOthers()&amp;lt;/code&amp;gt; method to know how many live enemies are in the battlefield.&lt;br /&gt;
&lt;br /&gt;
; '''I'm trying to recognize an enemy/teammate from its name (using &amp;lt;code&amp;gt;e.getName()&amp;lt;/code&amp;gt;) but the condition always fails. What's happening?'''&lt;br /&gt;
: Because of Java's funky way of interpreting references to Strings (not to mention a lack of operator overloading), you can't use an expression like &amp;lt;code&amp;gt;if (e.getName() == testname)&amp;lt;/code&amp;gt; to check for equality. You have to use the &amp;lt;code&amp;gt;String.equals()&amp;lt;/code&amp;gt; method, as in &amp;lt;code&amp;gt;if (e.getName().equals(testname))&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; '''How do I keep data from round to round and battle to battle?'''&lt;br /&gt;
: The easiest way is to save data between rounds of a battle is to make the variables in the bot class static. Because Robocode uses a separate classloader for every robot, the variables will not conflict even when you have more than one copy of a robot in a battle. Note that this will save data between ''rounds'', not between ''battles''. To save between battles you will have to save to a file. The maximum allowed disk space for files is 200k. Look at the [[:Category:Robocode API|Robocode API]] for more details.&lt;br /&gt;
&lt;br /&gt;
; '''I get the following message when I run my bot, and I don't know how to solve it.'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYSTEM: You have made 10000 calls to getXX methods without calling execute()&lt;br /&gt;
SYSTEM: Robot disabled: Too many calls to getXX methods.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
: Robocode prevents you from calling functions like &amp;lt;code&amp;gt;getX()&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;getVelocity()&amp;lt;/code&amp;gt; too many times during a single tick. So if you are using them in a long loop, it will raise this error. Actually, 95% of the time, this error is a symptom of an infinite loop in your bot. If you know you have a long-but-finite loop and you get this error, either just assign the values you want to use to a variable or use a [[RobotStatus]] object obtained from [[StatusEvent]].&lt;br /&gt;
&lt;br /&gt;
; '''I'm using &amp;lt;code&amp;gt;bulletObject = setFireBullet(power)&amp;lt;/code&amp;gt; to fire, and then I want to get the bullet coordinates. But when I try to print them using &amp;lt;code&amp;gt;System.out.println(bulletObject.getX() + bulletObject.getY())&amp;lt;/code&amp;gt; I get an error. What's wrong?'''&lt;br /&gt;
: &amp;lt;code&amp;gt;setFireBullet()&amp;lt;/code&amp;gt; creates a Bullet object, but the bullet doesn't actually leave your bots gun until the next tick, so you can't do &amp;lt;code&amp;gt;getX()&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;getY()&amp;lt;/code&amp;gt; on the bullet until then. If you change it to &amp;lt;code&amp;gt;fireBullet()&amp;lt;/code&amp;gt; you should be OK, because the function won't return until the bullet is in the air. If &amp;lt;code&amp;gt;fireBullet()&amp;lt;/code&amp;gt; won't work for you, you'll have to devise another method of making sure that you don't do &amp;lt;code&amp;gt;getX()&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;getY()&amp;lt;/code&amp;gt; on bullets until the turn after you fire. For example, you could store Bullets in an ArrayList, and print out their coordinates before you fire in your main loop, so that a given bullet will be added to the vector on one turn, but won't be accessed until the next turn when your main loop starts over. Alternatively, your bot can attempt to predict/simulate it's own location on the next tick, to know where the bullet will be created.&lt;br /&gt;
&lt;br /&gt;
; '''I want to reverse my direction when my movement is about to finish. I use something like &amp;lt;code&amp;gt;if (getDistanceRemaining() &amp;lt; minimum)&amp;lt;/code&amp;gt;, but the bot behaves in a strange way.'''&lt;br /&gt;
: The &amp;lt;code&amp;gt;getDistanceRemaining()&amp;lt;/code&amp;gt; method (and in general all methods returning remaining movements of the body, gun, or radar) can return a positive or a negative value, depending on the direction of your movement. Use &amp;lt;code&amp;gt;if (Math.abs(getGetDistanceRemaining()) &amp;lt; minimum)&amp;lt;/code&amp;gt; instead.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
=== Robot API ===&lt;br /&gt;
* [http://robocode.sourceforge.net/docs/robocode/ Robot API]&lt;br /&gt;
&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [[Robocode/System Requirements|System Requirements for Robocode]]&lt;br /&gt;
* [[Robocode/Download|How to download and install Robocode]]&lt;br /&gt;
* [[Robocode/Robot Anatomy|The anatomy of a robot]]&lt;br /&gt;
* [[Robocode/Getting Started|Getting started with Robocode]]&lt;br /&gt;
* [[Robocode/My First Robot|My First Robot Tutorial]]&lt;br /&gt;
* [[Robocode/Game Physics|Robocode Game Physics]]&lt;br /&gt;
* [[Robocode/Scoring|Scoring in Robocode]]&lt;br /&gt;
* [[Robocode/Robot Console|Using the robot console]]&lt;br /&gt;
* [[Robocode/Downloading_Robots|Downloading other robots]]&lt;br /&gt;
* [[Robocode/Learning from Robots|Learning from other robots]]&lt;br /&gt;
* [[Robocode/Package Robot|Package your robot]]&lt;br /&gt;
* [[Robocode/Articles|Articles about Robocode]]&lt;br /&gt;
* [[Robocode/Console Usage|Starting Robocode from the command line]]&lt;br /&gt;
* [[Robocode/Graphical_Debugging|Graphical debugging]]&lt;br /&gt;
* [[Robocode/Eclipse|Using Eclipse as IDE]]&lt;br /&gt;
* [[Robocode/Eclipse/Create_a_Project|Creating a project for your robots]]&lt;br /&gt;
* [[Robocode/Eclipse/Create_a_Robot|Creating a robot in Eclipse]]&lt;br /&gt;
* [[Robocode/Running from Eclipse|Running your robot from Eclipse]]&lt;br /&gt;
* [[Robocode/Eclipse/Debugging Robot|Debugging your robot with Eclipse]]&lt;br /&gt;
&lt;br /&gt;
=== News and Releases ===&lt;br /&gt;
* [http://sourceforge.net/export/rss2_project.php?group_id=37202 RSS Feeds for the Robocode project]&lt;br /&gt;
* [http://sourceforge.net/project/showfiles.php?group_id=37202&amp;amp;package_id=29609 Robocode file releases]&lt;br /&gt;
&lt;br /&gt;
=== Home pages ===&lt;br /&gt;
* [http://robocode.sourceforge.net/ Classic homepage]&lt;br /&gt;
* [http://sourceforge.net/projects/robocode Robocode project at SourceForge]&lt;br /&gt;
* [http://robocoderepository.com/ Robocode Repository]&lt;br /&gt;
* [[wikipedia:Robocode|Wikipedia entry for Robocode]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Robocode Documentation]]&lt;/div&gt;</summary>
		<author><name>Bostonvaulter</name></author>
		
	</entry>
	<entry>
		<id>http://robowiki.net/w/index.php?title=Robocode/Eclipse/Create_a_Robot&amp;diff=15550</id>
		<title>Robocode/Eclipse/Create a Robot</title>
		<link rel="alternate" type="text/html" href="http://robowiki.net/w/index.php?title=Robocode/Eclipse/Create_a_Robot&amp;diff=15550"/>
		<updated>2010-04-07T07:54:17Z</updated>

		<summary type="html">&lt;p&gt;Bostonvaulter: /* Creating a Robot in Eclipse */ added link to my first robot tutorial&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page describes how to create a robot in [http://www.eclipse.org/ Eclipse], and assume that you already now [[Robocode/Eclipse/Create a Project|how to create a project in Eclipse]].&lt;br /&gt;
&lt;br /&gt;
== Creating a Robot in Eclipse ==&lt;br /&gt;
Ok, so we have a project now, and it's time to create a robot (or many robots!) in it.&lt;br /&gt;
&lt;br /&gt;
First, right-click on the '''MyRobots''' project, and select New -&amp;gt; Class:&lt;br /&gt;
&lt;br /&gt;
[[Image:Eclipse-NewClass.png|Shows how to select a new class by right-clicking on the MyRobots project]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, fill in the package name (Robocode suggests your initials), a Robot Name (here I have '''FnlBot'''), and change the '''Superclass''' field to '''robocode.Robot''':&lt;br /&gt;
&lt;br /&gt;
[[Image:Eclipse-NewJavaClass.png|Shows the dialog for creating a new Java class named FnlBot, which is inherited from the robocode.Robot class]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Click '''Finish''', and you'll see your robot class, like this:&lt;br /&gt;
&lt;br /&gt;
[[Image:Eclipse-FnlBotEdit1.png|Shows editing the newly created FnlBot.java source file, which is empty and needs to be filled out with some code]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can now edit your robot however you like.&lt;br /&gt;
&lt;br /&gt;
[[Image:Eclipse-FnlBotEdit2.png|Shows editing the newly created FnlBot.java source file, which has now been filled out with a bit more meaningful code]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can save your robot as often as you like by hitting '''CTRL-S''', or selecting '''File-&amp;gt;Save'''. There's no need to explicit select '''Compile''' (as in the Robot Editor for [[Robocode]]) anymore, since Eclipse automatically takes care of this task for you, when you make changes to your files.&lt;br /&gt;
&lt;br /&gt;
Have fun playing around with Eclipse. Since there's no better way to learn than by playing around, I'll leave you to it!&lt;br /&gt;
&lt;br /&gt;
If you want help starting a robot you should check out the [[Robocode/My First Robot|My First Robot]] tutorial&lt;br /&gt;
&lt;br /&gt;
The only thing left is to make sure that [[Robocode/Add a Robot Project|Robocode sees your robot]].&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://www.eclipse.org/ Eclipse.org - Eclipse home page]&lt;br /&gt;
* [http://www.eclipse.org/downloads/ Eclipse Downloads]&lt;br /&gt;
* [http://download.eclipse.org/eclipse/downloads/ Eclipse project downloads - latest releases]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
=== Using Eclipse IDE ===&lt;br /&gt;
* [[Robocode/Eclipse|Using Eclipse as IDE]]&lt;br /&gt;
* [[Robocode/Eclipse/Create_a_Project|Creating a project for your robots]]&lt;br /&gt;
* [[Robocode/Add_a_Robot_Project|Add robot project from an IDE into Robocode]]&lt;br /&gt;
* [[Robocode/Running from Eclipse|Running your robot from Eclipse]]&lt;br /&gt;
* [[Robocode/Eclipse/Debugging Robot|Debugging your robot with Eclipse]]&lt;br /&gt;
&lt;br /&gt;
=== Robot API ===&lt;br /&gt;
* [http://robocode.sourceforge.net/docs/robocode/ Robot API]&lt;br /&gt;
&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [[Robocode/System Requirements|System Requirements for Robocode]]&lt;br /&gt;
* [[Robocode/Download|How to download and install Robocode]]&lt;br /&gt;
* [[Robocode/Robot Anatomy|The anatomy of a robot]]&lt;br /&gt;
* [[Robocode/Getting Started|Getting started with Robocode]]&lt;br /&gt;
* [[Robocode/My First Robot|My First Robot Tutorial]]&lt;br /&gt;
* [[Robocode/Game Physics|Robocode Game Physics]]&lt;br /&gt;
* [[Robocode/Scoring|Scoring in Robocode]]&lt;br /&gt;
* [[Robocode/Robot Console|Using the robot console]]&lt;br /&gt;
* [[Robocode/Downloading_Robots|Downloading other robots]]&lt;br /&gt;
* [[Robocode/Learning from Robots|Learning from other robots]]&lt;br /&gt;
* [[Robocode/Package Robot|Package your robot]]&lt;br /&gt;
* [[Robocode/FAQ|Frequently Asked Questions (FAQ)]]&lt;br /&gt;
* [[Robocode/Articles|Articles about Robocode]]&lt;br /&gt;
* [[Robocode/Console Usage|Starting Robocode from the command line]]&lt;br /&gt;
* [[Robocode/Graphical_Debugging|Graphical debugging]]&lt;br /&gt;
&lt;br /&gt;
=== News and Releases ===&lt;br /&gt;
* [http://sourceforge.net/export/rss2_project.php?group_id=37202 RSS Feeds for the Robocode project]&lt;br /&gt;
* [http://sourceforge.net/project/showfiles.php?group_id=37202&amp;amp;package_id=29609 Robocode file releases]&lt;br /&gt;
&lt;br /&gt;
=== Home pages ===&lt;br /&gt;
* [http://robocode.sourceforge.net/ Classic homepage]&lt;br /&gt;
* [http://sourceforge.net/projects/robocode Robocode project at SourceForge]&lt;br /&gt;
* [http://robocoderepository.com/ Robocode Repository]&lt;br /&gt;
* [[wikipedia:Robocode|Wikipediaentry for Robocode]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Robocode Documentation]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Eclipse IDE]]&lt;/div&gt;</summary>
		<author><name>Bostonvaulter</name></author>
		
	</entry>
</feed>