Improvements
The highlighted comment was created in this revision.
Yeah, clearly less aggressive distancing and bullet power helps out a bunch here. Now that we've changed the default distance we also need to change the reverse probability, all those need to go to 29. Also, I really wonder if there isn't some way to reduce the number of sacrifice rounds at the beginning against top-bots. Perhaps have something like what I do in Toorkild with using total enemy damage received to trip the movement modes instead of number of deaths.
Hmm, fewer exploitative rounds would almost certainly increase PL--er, PWIN, but it might reduce APS against weak bots. I suppose we could try going back to four rounds of exploitative movement and see if that helps.
I don't see any plausible mode-selection other than the one we have now. The amount of Codesize we have to work with is far too small to even implement something like Splinter's, let alone Toorkild's.
You could always enter a few new bots that LBB doesn't have data on. ;) Seems kinda cheap, but hey, you live by the black book, you die by the black book...
Would we be able to save a few bytes by eliminating unnecessary casting? For instance, we could make BULLET_POWER
an int
constant so the anti-ram doesn't have to be cast to a double
. (Plus, 2 hard-coded as an int
is two bytes cheaper than 2 hard-coded as a double
.) Also, we could make DISTANCE_FACTOR
a double
constant so it doesn't get cast as a double
when we use it to divide getVelocity()
.
I'm somewhat surprised by the ~0.1% drop in APS after changing match length reduction. It seems it tried too hard to predict random movement and got fooled more easily. I guess we'll go back to 1.1.4's method, unless you have any other ideas.
I don't think a much longer match length so much predicts random movement as it does oscillators that don't use random numbers.
Anyway, I made those changes, and the bullet power one saves us a single byte. Not sure what to do with two bytes though...
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.
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.
Is there any way we could store a negative char
value and get rid of the
- (1.1 - 1e-8)
code?
I don't think so. That is there for the bullet detection, and the char value is multiplied by the random so if we used it for bullet detection it wouldn't be reliable. We're down to 246 bytes though, so any ideas of what else to add?
I think I identified where the score difference between 1.1.6 and 1.1.4 crept in, it was from Yatagan stopping if the radar slipped. My local tests show that increasing the direction
to 48 fixes the bots that had the biggest score discrepancies.