Improvements

Jump to navigation Jump to search

I might have another byte for you. I have been doing some experimenting my my movement code and obviously also looking at yatagan since it is the best. One tweak I have tried (but not yet benchmarked or verified) that looks like it saves one byte is to not use infinity for direction. This then allows you to use direction rather than getVelocity() in the turning code, which should save a byte. Something like:

 private final static double VERY_BIG            = 1e+200;
private final static double CLOSE_FACTOR = VERY_BIG * 430;
...
turnRadarRightRadians(direction = VERY_BIG);
...
setTurnRightRadians(Math.cos((rd = e.getBearingRadians()) - (e.getDistance() - PREFERRED_RANGE) * (direction / CLOSE_FACTOR)));


This should work provided there is nothing weird in the robocode radar which will cause issues without the infinity.

Nz.jdc (talk)14:07, 27 May 2013

That's a very cool idea. The only thing I'd be concerned about is the radar, since it will subtract the amount it turns from the getRadarTurnRemainingRadians() and could eventually run out (although not really an issue if it is 1e200). Perhaps by reading in degrees and writing in radians for the infinity lock we could negate that, though. In fact, we could probably get away with a smaller value. I'll give it a spin when I get home.

Skilgannon (talk)14:24, 27 May 2013

Looks like it works ok. I was worried about depletion too, especially when I saw you use 48 (any reason for that number in particular?), then I actually thought about it and noted the rad/deg growth, so anything down to 2PI should be ok :)

Nz.jdc (talk)01:45, 29 May 2013

48 is the distance of a stop-and-go move, so my thoughts are that it will be big enough that on the enemy death it will avoid HOT, but won't go into walls.

Skilgannon (talk)08:19, 29 May 2013

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:Talk:Yatagan/Source/Improvements/reply (14).

Apparently not. I guess I should've tested that before I published it.

Sheldor (talk)14:01, 29 May 2013