weird bug I'm hitting

Jump to navigation Jump to search

weird bug I'm hitting

I'm hitting a bizarre bug in either Robocode or my JVM. Basically, I calculate the enemy's position each tick, and on successive ticks, the distance between the positions is greater than 8, which should be impossible. Frequently it's like 11 or 15, occasionally more like 40 or 70. Can anyone else duplicate this? It seems to only happen when running minimized, so I don't think it's any issue with my code. And I'm checking that e.getTime() is only 1 apart, so it's not skipped turns. And it is happening in 1v1 with a radar lock.

For a while this came in the form of thinking my freshly rewritten scan interpolation had a bug. (Which seemed a lot like the "bug" in the old interpolation code...)

This is the right calculation of enemy location, right?

 Point2D.Double enemyLocation = 
     project(new Point2D.Double(getX(), getY()), Utils.normalAbsoluteAngle(
         e.getBearingRadians() + getHeadingRadians()),
         e.getDistance());
 public static Point2D.Double project(Point2D.Double sourceLocation,
     double angle, double length) {
   return project(sourceLocation, Math.sin(angle), Math.cos(angle), length);
 }
 public static Point2D.Double project(Point2D.Double sourceLocation,
     double sinAngle, double cosAngle, double length) {
   return new Point2D.Double(sourceLocation.x + sinAngle * length,
       sourceLocation.y + cosAngle * length);
 }

Voidious08:12, 2 June 2012

Works fine for me (mac).

Wompi09:09, 2 June 2012
 

Your code here looks fine. Have you tried a simple radar + test bot?

Skilgannon12:33, 2 June 2012
 

Hm, the code looks fine to me. Can you perhaps have Robocode save a replay file, and make note of the ticks your robot notices things moving too fast? That way we could compare this to Robocode's internal representation of things, so it would be easier to tell where the problem is.

Rednaxela16:14, 2 June 2012
 

You do not have permission to edit this page, for the following reasons:

  • The action you have requested is limited to users in the group: Users.
  • You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.

You can view and copy the source of this page.

Return to Thread:User talk:Voidious/weird bug I'm hitting/reply (4).

 

Hmm, I've tried to reproduce this but it never seems to occur unless a turn was skipped.

Rednaxela07:02, 3 June 2012