Menu

#17 Events not always removed from internal Vector

none
unread
nobody
1
2016-05-26
2012-12-15
Anonymous
No

Hi,

I noticed a possible bug in the event handling system.
It seems that, on a rare occasion, some Events are not properly removed from the interal Vector containing all the Events (the Vector returned by getAllEvents()).
Most of the time these are ScannedRobotEvent object but sometimes also other Events aren't removed.

With "rare" I mean that it only happens just a couple of times every 20 or so rounds but sometimes it happens even more than once in 1 round.
I don't know under what specific circumstances the bug arises apart from the following:
- I let my bot fight a team of 4 sample bots (instead of 4 separate sample bots). All bots are crazy bots.
- The total amount of rounds is 200.
- The battlefield has a size of 800x600.
- Im using robocode 1.7.4.4 with Java 1.7.0_09 (64-bits) on Windows 7 Home Premium SP1 64-bit.

I used the following code in onStatus() to reproduce the bug:

public void onStatus(StatusEvent event) {
    for(Event e : getAllEvents()) {
        if(e.getTime() < getTime()) {
            out.printf("%s not removed getTime(): %d; event time: %d\n",
                    e.getClass(), getTime(), e.getTime());
        }
    }
}

Producing the output:

=========================
Round 29 of 200
=========================
class robocode.ScannedRobotEvent not removed getTime(): 388; event time: 387
class robocode.ScannedRobotEvent not removed getTime(): 389; event time: 388
SYSTEM: Bonus for killing sample.Crazy (3): 14
SYSTEM: Bonus for killing sample.Crazy (1): 32
SYSTEM: Bonus for killing sample.Crazy (2): 2
SYSTEM: Ram bonus for killing sample.Crazy (4): 11
SYSTEM: theArtOfSteel.TheArtOfSteel 0.1* wins the round.

and:

=========================
Round 66 of 200
=========================
class robocode.ScannedRobotEvent not removed getTime(): 50; event time: 49
class robocode.ScannedRobotEvent not removed getTime(): 51; event time: 50
class robocode.ScannedRobotEvent not removed getTime(): 51; event time: 50
class robocode.HitRobotEvent not removed getTime(): 52; event time: 51
class robocode.ScannedRobotEvent not removed getTime(): 52; event time: 51
class robocode.ScannedRobotEvent not removed getTime(): 52; event time: 51
SYSTEM: Bonus for killing sample.Crazy (4): 15
SYSTEM: Bonus for killing sample.Crazy (1): 25
SYSTEM: theArtOfSteel.TheArtOfSteel 0.1* wins the round.

I hope you can look into this matter.

Greets, BitJunky

Discussion

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.