Examples of GoCaptureList


Examples of com.barrybecker4.game.twoplayer.go.board.move.GoCaptureList

        clearEyes();
        GoBoardPosition stone = (GoBoardPosition) (getBoard().getPosition(move.getToLocation()));

        board_.adjustLiberties(stone);

        GoCaptureList captures = determineCaptures(stone);
        move.setCaptures(captures);

        updateStringsAfterMove(stone);
        captures.removeFromBoard(getBoard());

        assert (stone.getString().getNumLiberties(getBoard()) > 0):
            "The placed stone " + stone + " has no liberties "+stone.getGroup() +"\n"+ getBoard().toString();
        updateGroupsAfterMove(stone);
        captureCounter_.updateCaptures(move, true);
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.move.GoCaptureList

    private GoCaptureList determineCaptures(GoBoardPosition stone) {

        profiler_.startFindCaptures();
        assert ( stone != null );
        GoBoardPositionSet nbrs = nbrAnalyzer_.getNobiNeighbors( stone, NeighborType.ENEMY );
        GoCaptureList captureList = new GoCaptureList();
        // keep track of the strings captured so we don't capture the same one twice
        GoStringSet capturedStrings = new GoStringSet();

        for (GoBoardPosition enbr : nbrs) {

            assert (enbr.isOccupied()): "enbr=" + enbr;

            IGoString str = enbr.getString();
            assert ( str.isOwnedByPlayer1() != stone.getPiece().isOwnedByPlayer1()):
                    "The "+str+" is not an enemy of "+stone;
            assert ( str.size() > 0 ) : "Sting has 0 stones:" + str;

            if ( str.getNumLiberties(getBoard()) == 0 && !capturedStrings.contains(str) ) {
                capturedStrings.add( str );
                // we need to add copies so that when the original stones on the board are
                // changed we don't change the captures.
                captureList.addCaptures(str.getMembers());
            }
        }
        profiler_.stopFindCaptures();
        return  captureList;
    }
View Full Code Here
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.