Count Robots on Field, place in array

Jesse Bevil <[email protected]> Wed, 5 Oct 2016 20:45:50 -0700 (PDT)
Newsgroups gmane.comp.java.robocode
Message-ID <[email protected]>
So I'm looking to count the number of robots on the field. Not really sure 
how I can accomplish that. I was thinking that if I make a multi-dimension 
array and on each scanned robot save e.getName and e.getDistance and then 
sort the array from lowest to highest distance, then select the target at 
the top index of the array that I could improve survivability. I'm new to 
RoboCode (about an hour ago), I am also new to Java (Fundamentals I class 
in college, received an A, but doesn't really mean much without 
experience). 

So I suppose my problem is basically how to go about creating the array 
that stores both the string and the integer short of creating two arrays. 
I'm sure this idea is fairly basic and has likely already been done, but it 
was my first thought when I considered avoiding shooting at the first thing 
I saw (something could be closer).

Also while looking at the API I noticed that there was an option to 
getClassName() which I suppose if I can use that within the scanner I could 
get the specific class name for a robot, IE: if 
e.GetClassName().Equals(Tracker) { handle tracker robot code goes here}. I 
could handle specific sample robots. Though I don't think the goal would be 
to beat the sample robots, more so the other robots other people code?

I would like to say that I have a clue where to start so that I could 
provide some level of attempted code, but honestly I can't think of how to 
approach the array situation, which is the basic question. I can write the 
code to sort the information after I've got an idea of how to store it. 

Thanks in advance for any assistance. 

-- 
You received this message because you are subscribed to the Google Groups "robocode" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.