Examples of GoGroupSet


Examples of com.barrybecker4.game.twoplayer.go.board.elements.group.GoGroupSet

    /**
     * verify that all the stones on the board are in the boards member list of groups.
     */
    public void confirmStonesInValidGroups() {

        GoGroupSet groups = board_.getGroups();
        for ( int i = 1; i <= board_.getNumRows(); i++ )  {
            for ( int j = 1; j <= board_.getNumCols(); j++ ) {
                GoBoardPosition space = (GoBoardPosition) board_.getPosition( i, j );
                if ( space.isOccupied() )  {
                    groups.confirmStoneInValidGroup(space);
                }
            }
        }
    }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.elements.group.GoGroupSet

     * The structure of the groups can change after a move.
     * First remove all the groups, and then find them again.
     */
    protected void recreateGroupsAfterChange() {

        GoGroupSet groups = new GoGroupSet();

        addFluxGroups(groups);

        board_.setGroups(groups);
        board_.unvisitAll();
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.elements.group.GoGroupSet

    /**
     * remove groups that have no stones in them.
     */
    void cleanupGroups() {
        GoGroupSet newGroups = new GoGroupSet();

        for (IGoGroup group: getAllGroups()) {

            if ( group.getNumStones() > 0 )  {
                newGroups.add(group);
            }
        }
        board_.setGroups(newGroups);
    }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.elements.group.GoGroupSet

     */
    @Override
    public void reset() {

        super.reset();
        groups_ = new GoGroupSet();

        setHandicap(getHandicap());
        init(new CaptureCounts());
    }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.elements.group.GoGroupSet

    /**
     * @return all the groups on the board for both sides.
     */
    GoGroupSet findAllGroups()  {
        GoGroupSet groups = new GoGroupSet();

        for ( int i = 1; i <= board_.getNumRows(); i++ )  {
            for ( int j = 1; j <= board_.getNumCols(); j++ ) {
                GoBoardPosition pos = (GoBoardPosition)board_.getPosition(i, j);
                if (pos.isOccupied() && !groups.containsPosition(pos)) {
                    // would this run faster if  second param was false?
                    groups.add(new GoGroup(findGroupFromInitialPosition(pos, true)));
                }
            }
        }
        return groups;
    }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.elements.group.GoGroupSet

     * @param groupStones the set of stones in the group to find enemies of.
     * @return a HashSet of the groups that are enemies of this group
     */
    private Set getEnemyGroupNeighbors(GoBoardPositionSet groupStones, boolean isPlayer1)  {
        GoProfiler.getInstance().startGetEnemyGroupNbrs();
        GoGroupSet enemyNbrs = new GoGroupSet();
        NeighborAnalyzer nbrAnalyzer =  new NeighborAnalyzer(board);

        // for every stone in the group.
        for (GoBoardPosition stone : groupStones) {
            GoBoardPositionSet nbrs = nbrAnalyzer.findGroupNeighbors(stone, false);
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.