Examples of MutableIntLocation


Examples of com.barrybecker4.common.geometry.MutableIntLocation

    /**
     * Find the potential for one of the bbox's rows or columns.
     * @return eye potential for row and column at pos
     */
    public float getRunPotential(Location position, int rowInc, int colInc, int maxRow, int maxCol) {
        MutableIntLocation pos = new MutableIntLocation(position);
        float runPotential = 0;
        int breadth = (rowInc == 1) ? (maxRow - pos.getRow()) : (maxCol - pos.getCol());
        GoBoardPosition startSpace = (GoBoardPosition) board_.getPosition( pos );

        do {
            GoBoardPosition nextSpace = (GoBoardPosition) board_.getPosition( pos );
            GoBoardPosition firstSpace = nextSpace;
            boolean containsEnemy = false;
            int runLength = 0;
            boolean player1 = groupString_.isOwnedByPlayer1();
            while (inRun(pos, maxRow, maxCol, nextSpace, player1)) {
                if (containsEnemy(player1, nextSpace)) {
                    containsEnemy = true;
                }
                runLength++;
                pos.increment(rowInc, colInc);
                nextSpace = (GoBoardPosition) board_.getPosition( pos );
            }
            boolean bounded = isBounded(startSpace, nextSpace, firstSpace);
            runPotential += accrueRunPotential(rowInc, pos, breadth, firstSpace, containsEnemy, runLength, bounded);

            pos.increment(rowInc, colInc);

        } while (pos.getCol() <= maxCol && pos.getRow() <= maxRow);

        return runPotential;
    }
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.