** (oldAngle-newAngle)/46.6 |
** (oldAngle-newAngle)/max_escape_angle // eg, Math.asin(max bot velocity/bullet velocity) |
** * Move Times: Number of ticks since the velocity was last 0. Useful against stop and go and oscillators. |
* Move Times: Number of ticks since the velocity was last 0, since velocity changed, or since velocity was max speed. Useful against stop and go and oscillators, and many other types of movement. Some tanks, like CassiusClay, also make this (inversely) proportional to the enemy's distance. |
** |
When gathering data for a statistical operation, you will segment on one or more of these variables. Here are most of the variables that are segmented on, feel free to add variables and how to collect them to the list.
(oldAngle-newAngle)/max_escape_angle // eg, Math.asin(max bot velocity/bullet velocity)
e.getDistance()
e.getDistance() / (20 - 3 * shotPower)
shotPower
e.getVelocity()
e.getHeading() - oldHeading
e.getHeading() - (e.getBearing() + getHeading()) // abs heading - abs bearing
e.getVelocity() * Math.sin(e.getHeadingRadians() - (e.getBearingRadians() + getHeadingRadians()))
e.getVelocity() * -1 * Math.cos(e.getHeadingRadians() - (e.getBearingRadians() + getHeadingRadians()))
int accelSegment(double deltaBearing, double oldDeltaBearing) { int delta = (int)(Math.round(5 * enemyDistance * (Math.abs(deltaBearing) - Math.abs(oldDeltaBearing)))); if (delta < 0) { return 0; } else if (delta > 0) { return 2; } return 1; }
if(enemyVelocity==0) moveTimes=0; else moveTimes++; moveTimesIndex = Math.min(9, moveTimes/5);
(e.getHeadingRadians() - e.getBearingRadians() + getHeadingRadians())But it seems to me it should be this:
(Math.PI - (e.getHeadingRadians() - (e.getBearingRadians() + getHeadingRadians()))Let's take two example situations. The opponent is directly above me, and we're both facing up (zero radians). The first solution gives 0 (sin=0, cos=1), the second gives Pi (sin=0, cos=-1). Clearly they are both right for the LateralVelocity, but the first gives them a positive AdvancingVelocity while the second gives a negative. Second example: we're in the same positions, but now my heading is Pi/4 (45 degrees). The first equation now calculates to (0 - (-Pi/4) + Pi/4) = Pi/2 (sin=1, cos=0), while the second calculates to (Pi - (0 - (Pi/4 - Pi/4))) = Pi (sin=0, cos=-1); the same as it did in the first situation. I see no way they should be 100% lateral and 0% advancing in this situation.
The "Math.Pi - ..." thing could be dropped if positive advancing = moving away from you, but it sounds like the opposite of that. Could somebody please just confirm to me that my assessment is correct? I'm pretty new to Robocode, and I'm afraid I'm just misunderstanding something here... Thanks. -- Voidious
Take another look at AdvancingVelocity:
double advancingvelocity = -Math.cos(e.getHeadingRadians()-absbearing)*e.getVelocity();Note you make Math.cos(angle) negative to get the AdvancingVelocity vector. Hope that helps. --Corbos
Yes, now I see that... Thanks. This means that I am looking at it correctly. It was still wrong on this page, though, as the last two pieces of the "angle" expression would need parens to be subtracing the absolute bearing. I'll go ahead and edit them here... -- Voidious
I believe I fixed the formula for relative heading, but I wouldn't mind somebody double checking it ;) (This page has been around a while...) -- Voidious