Re: Count Robots on Field, place in array

[email protected] Wed, 29 Nov 2017 14:33:38 -0800 (PST)
Newsgroups gmane.comp.java.robocode
Message-ID <[email protected]>
Could you share this code?

Em sábado, 8 de outubro de 2016 16:13:25 UTC-3, Jesse Bevil escreveu:
>
> On contemplating the issue. I've decided to try and create an ArrayList of 
> the object type, and then in a seperate class, create the object Enemy 
> which will store each enemy on the play field. Moving forward with the 
> idea. Though I feel it will require a bit of tweaking to get it sorted, 
> assuming it even works. 
>
> On Thursday, October 6, 2016 at 4:38:19 AM UTC-5, Jesse Bevil wrote:
>>
>> 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.