Logo Search packages:      
Sourcecode: filler version File versions  Download package

static void friendless::games::filler::FillerModel::allocateTypes ( FillerModel  model,
int[]  origins,
FillerPlayerSpace  space 
) [inline, static, package]

Build a calculation of who owns what and who has what influence over what.

Definition at line 275 of file FillerModel.java.

References allocate(), allocateFree(), BORDER, friendless::games::filler::FillerPlayerSpace::counted, FREE, HIS, HIS_BORDER, HIS_INTERNAL_BORDER, HIS_REACHABLE, friendless::games::filler::FillerPlayerSpace::hisReachable, INTERNAL_BORDER, MINE, REACHABLE, friendless::games::filler::FillerPlayerSpace::reachable, friendless::games::filler::FillerPlayerSpace::reset(), friendless::games::filler::FillerPlayerSpace::resetReachable(), and VACANT.

                                                                                         {
        // copy pointers from space into local variables
        int[] counted = space.counted;
        boolean[] reachable = space.reachable;
        boolean[] hisReachable = space.hisReachable;
        space.reset();
        space.resetReachable();
        allocate(model, origins[0], space, MINE, BORDER);
        allocate(model, origins[1], space, HIS, HIS_BORDER);
        allocateFree(model, space, BORDER, reachable);
        allocateFree(model, space, HIS_BORDER, hisReachable);
        for (int i=0; i<reachable.length; i++) {
            if (reachable[i]) {
                if (!hisReachable[i]) {
                    if (counted[i] == BORDER) {
                        counted[i] = INTERNAL_BORDER;
                    } else {
                        counted[i] = REACHABLE;
                    }
                } else if (counted[i] == VACANT) {
                    counted[i] = FREE;
                }
            } else if (hisReachable[i]) {
                if (counted[i] == HIS_BORDER) {
                    counted[i] = HIS_INTERNAL_BORDER;
                } else {
                    counted[i] = HIS_REACHABLE;
                }
            }
        }
    }


Generated by  Doxygen 1.6.0   Back to index