Bug
It seems ÉpéeistMicro has a bug somewhere in its gun code. It's throwing "ArrayIndexOutOfBounds" and "NullPointer" exceptions, especially against mirror bots.
The only change I made to the GF code was to change the constant MEA from .7 to 0.727272727272727272727273.
Any ideas?
Thanks
Here is the console from a battle against stelo.MirrorMicro 1.1.
=========================
Round 1 of 35
=========================
SYSTEM: sheldor.micro.EpeeistMicro 1.7.0 has died
=========================
Round 2 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
at sheldor.micro.EpeeistMicro$Wave.test(EpeeistMicro.java:219)
at net.sf.robocode.host.events.EventManager.callUserCode(EventManager.java:436)
at net.sf.robocode.host.events.EventManager.processEvents(EventManager.java:377)
at net.sf.robocode.host.proxies.BasicRobotProxy.executeImpl(BasicRobotProxy.java:417)
at net.sf.robocode.host.proxies.HostingRobotProxy.run(HostingRobotProxy.java:228)
at java.lang.Thread.run(Unknown Source)
=========================
Round 3 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
at sheldor.micro.EpeeistMicro$Wave.test(EpeeistMicro.java:219)
at net.sf.robocode.host.events.EventManager.callUserCode(EventManager.java:436)
at net.sf.robocode.host.events.EventManager.processEvents(EventManager.java:377)
at net.sf.robocode.host.proxies.BasicRobotProxy.executeImpl(BasicRobotProxy.java:417)
at net.sf.robocode.host.proxies.HostingRobotProxy.run(HostingRobotProxy.java:228)
at java.lang.Thread.run(Unknown Source)
=========================
Round 4 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
at sheldor.micro.EpeeistMicro$Wave.test(EpeeistMicro.java:219)
at net.sf.robocode.host.events.EventManager.callUserCode(EventManager.java:436)
at net.sf.robocode.host.events.EventManager.processEvents(EventManager.java:377)
at net.sf.robocode.host.proxies.BasicRobotProxy.executeImpl(BasicRobotProxy.java:417)
at net.sf.robocode.host.proxies.HostingRobotProxy.run(HostingRobotProxy.java:228)
at java.lang.Thread.run(Unknown Source)
=========================
Round 5 of 35
=========================
SYSTEM: Bonus for killing stelo.MirrorMicro 1.1: 10
SYSTEM: sheldor.micro.EpeeistMicro 1.7.0 wins the round.
=========================
Round 6 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 7 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 8 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 9 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 10 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 11 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 12 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 13 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 14 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 15 of 35
=========================
SYSTEM: Bonus for killing stelo.MirrorMicro 1.1: 9
SYSTEM: sheldor.micro.EpeeistMicro 1.7.0 wins the round.
=========================
Round 16 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 17 of 35
=========================
SYSTEM: Bonus for killing stelo.MirrorMicro 1.1: 8
SYSTEM: sheldor.micro.EpeeistMicro 1.7.0 wins the round.
=========================
Round 18 of 35
=========================
SYSTEM: Bonus for killing stelo.MirrorMicro 1.1: 12
SYSTEM: sheldor.micro.EpeeistMicro 1.7.0 wins the round.
=========================
Round 19 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 20 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: sheldor.micro.EpeeistMicro 1.7.0 has died
=========================
Round 21 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 22 of 35
=========================
SYSTEM: Bonus for killing stelo.MirrorMicro 1.1: 8
SYSTEM: sheldor.micro.EpeeistMicro 1.7.0 wins the round.
=========================
Round 23 of 35
=========================
SYSTEM: Bonus for killing stelo.MirrorMicro 1.1: 8
SYSTEM: sheldor.micro.EpeeistMicro 1.7.0 wins the round.
=========================
Round 24 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 25 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 26 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 27 of 35
=========================
SYSTEM: sheldor.micro.EpeeistMicro 1.7.0 has died
=========================
Round 28 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 29 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 30 of 35
=========================
SYSTEM: sheldor.micro.EpeeistMicro 1.7.0 has died
=========================
Round 31 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 32 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 33 of 35
=========================
SYSTEM: Bonus for killing stelo.MirrorMicro 1.1: 12
SYSTEM: sheldor.micro.EpeeistMicro 1.7.0 wins the round.
=========================
Round 34 of 35
=========================
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
SYSTEM: Exception occurred on robocode.ScannedRobotEvent
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
=========================
Round 35 of 35
=========================
SYSTEM: Bonus for killing stelo.MirrorMicro 1.1: 12
SYSTEM: sheldor.micro.EpeeistMicro 1.7.0 wins the round.
Looks, like here you have a problem: [(int)enemyDistance / 200] Distance may be more than 800 units (sqrt(800*800 + 600*600)=1000), but you give for this dimension only 4 elements It's another problem, but i cannot find out other problems by codereview and it's too late to debugging it, sorry
I'm sorry, I don't understand what you're saying. On an 800 by 600 field, the maximum possible distance would be 764, 764 divided by 200 would be 3.82, and 3.82 cast to an int would be 3. Besides, Thorn and a few other micros use the same distance segment code and don't have a problem.
On an 800x600 field, the distance between opposite corners is 1000 (forming a 3/4/5 right triangle). So I think you do need another distance segment, but I haven't looked through your code/logs enough to be sure that's the problem above.
Thanks! You both nailed it. In older versions I initialized the dimension to 7, I forgot to mention I had reduced it to 4 to save a byte. The reason it was losing to mirror bots was because they were in the opposite corner exactly the same time EM was.
I will give you both a mention in the credits.
Do you use any version control system (git, mercurial, etc)? I recommend to use it. It will facilitate for such bugs detection.
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
Return to Thread:Talk:ÉpéeistMicro/Bug/reply (10).
I use Maven as build system. Never tried gradle.
And I´m not currently using any version control system, but I might try git. There was one episode in the past when I lost hours trying to figure out why my bot score dropped about 30% in challenges. I could have found the bug in minutes with version control.
We are use ant and maven at work for enterprise project and gradual migrate to gradle, so i definitely can suggest to try gradle^) Especially because you can easy generate gradle project from maven project: http://gradle.org/docs/current/userguide/bootstrap_plugin.html