[Home]VisitCountStats/Dynamic

Robo Home | VisitCountStats | Changes | Preferences | AllPages

Showing revision 1
Dynamic guess factors here means you create a different number of guess factors for different enemy distances. The point is that so that you shouldn't need smoothing the curve or calculate kernel densities or whatever before acting on the data in your stat buffers. It also keeps your stat files no bigger than necessary (that's my mantra, small stat files...=). Here's how it is implemented in GloomyDark. It assumes you are segmenting on distance, but that is a good segmentation in most cases:
...
    public static final double BOT_WIDTH = 36;
...

    int numFactors(double distance) {
        int n = (int)(1.25 * (distance / bulletVelocity(DEFAULT_BULLET_POWER) * MAX_VELOCITY / BOT_WIDTH));
        return n + 1 - n % 2;
    }

    int[][][][][] makeAimFactorVisits() {
        int[][][][][] factors = new int[ACCEL_SEGMENTS][AIM_VELOCITY_SEGMENTS][AIM_DISTANCE_SEGMENTS][1][];
        for (int a = 0; a < ACCEL_SEGMENTS; a++) {
            for (int v = 0; v < getAimVelocitySegments(); v++) {
                for (int d = 0; d < getAimDistanceSegments(); d++) {
                    factors[a][v][d][0] = new int[numFactors((d + 1) * getBattleFieldWidth() / AIM_DISTANCE_SEGMENTS)];
                }
            }
        }
        return factors;
    }
As you can see I create a few extra segments, but I'm not sure that's necessary. Details like that take a long time to test... -- PEZ

Robo Home | VisitCountStats | Changes | Preferences | AllPages
Edit revision 1 of this page | View other revisions | View current revision
Edited October 27, 2003 11:47 EST by PEZ (diff)
Search: