Examples of GoBoardPositionSet


Examples of com.barrybecker4.game.twoplayer.go.board.elements.position.GoBoardPositionSet

    /**
     * @return a list of the stones in this group.
     */
    @Override
    public GoBoardPositionSet getStones() {
        GoBoardPositionSet stones = new GoBoardPositionSet();
        for (IGoString string : getMembers()) {
            stones.addAll(string.getMembers());
        }
        return stones;
    }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.elements.position.GoBoardPositionSet

        return numEdgePoints_;
    }

    @Override
    protected void initializeMembers() {
        members_ = new GoBoardPositionSet();
    }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.elements.position.GoBoardPositionSet

    public void invalidate() {
        cacheValid = false;
    }

    private void initializeLiberties() {
        liberties_ = new GoBoardPositionSet();
        GoBoardPositionSet members = string.getMembers();

        for (GoBoardPosition stone : members) {
            addLiberties(stone, board);
        }
        cacheValid = true;
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.elements.position.GoBoardPositionSet

     * @return the eye type determined based on the properties and
     *     nbrs of the positions in the spaces_ list.
     */
    public EyeInformation determineEyeInformation()
    {
        GoBoardPositionSet spaces = eye_.getMembers();
        assert (spaces != null): "spaces_ is null";
        int size = spaces.size();

        if (isFalseEye()) {
            return new FalseEyeInformation();
        }
        if ( size == 1 ) {
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.elements.position.GoBoardPositionSet

     * Iterate through the spaces_ in the eye.
     * if any are determined to be a false-eye, then return false-eye for the eye type.
     * @return true if we are a false eye.
     */
    private boolean isFalseEye()  {
        GoBoardPositionSet spaces = eye_.getMembers();
        for (GoBoardPosition space : spaces) {
            if ( isFalseEye( space) ) {
                return true;
            }
        }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.elements.position.GoBoardPositionSet

    /**
     * @param empties a list of unoccupied positions.
     * @return a list of stones bordering the set of empty board positions.
     */
    GoBoardPositionSet findOccupiedNobiNeighbors(GoBoardPositionList empties) {
        GoBoardPositionSet allNbrs = new GoBoardPositionSet();
        for (GoBoardPosition empty : empties) {
            assert (empty.isUnoccupied());
            GoBoardPositionSet nbrs = getNobiNeighbors(empty, false, NeighborType.OCCUPIED);
            // add these nbrs to the set of all nbrs
            // (dupes automatically culled because HashSets only have unique members)
            allNbrs.addAll(nbrs);
        }
        return allNbrs;
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.elements.position.GoBoardPositionSet

     * @param neighborType (EYE, NOT_FRIEND etc)
     * @return a set of stones that are immediate (nobi) neighbors.
     */
    GoBoardPositionSet getNobiNeighbors(GoBoardPosition stone, boolean friendOwnedByP1,
                                        NeighborType neighborType) {
       GoBoardPositionSet nbrs = new GoBoardPositionSet();
        int row = stone.getRow();
        int col = stone.getCol();

        if ( row > 1 )
            addNobiNeighbor( (GoBoardPosition) board_.getPosition(row - 1, col),
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.elements.position.GoBoardPositionSet

    GoBoardPositionSet findGroupNeighbors(GoBoardPosition stone,
                                            boolean friendPlayer1, boolean samePlayerOnly) {
        GoBoardPositionList stack = new GoBoardPositionList();

        pushGroupNeighbors( stone, friendPlayer1, stack, samePlayerOnly );
        GoBoardPositionSet nbrStones = new GoBoardPositionSet();
        nbrStones.addAll( stack );

        return nbrStones;
    }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.elements.position.GoBoardPositionSet

     * @param eye eye the eye space string we are currently analyzing.
     * @param pos empty position within eye.
     * @param nbrStrings the list to add neighboring still living strings to.
     */
    private void findNeighborStringsForEyeSpace(IGoEye eye, GoBoardPosition pos, List<IGoString> nbrStrings) {
        GoBoardPositionSet nbrs =
                nbrAnalyzer_.getNobiNeighbors(pos, eye.isOwnedByPlayer1(), NeighborType.FRIEND);
        for (GoBoardPosition nbr : nbrs) {

            if (nbr.getString().getGroup() != group_) {
                // this eye is not unconditionally alive (UA).
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.elements.position.GoBoardPositionSet

     * @return true if all the empty spaces in this eye are touching the specified string.
     */
    private boolean allUnocupiedAdjacentToString(IGoEye eye, IGoString string)   {
        for (GoBoardPosition pos : eye.getMembers()) {
            if (pos.isUnoccupied()) {
                GoBoardPositionSet nbrs =
                        nbrAnalyzer_.getNobiNeighbors(pos, eye.isOwnedByPlayer1(), NeighborType.FRIEND);
                // verify that at least one of the nbrs is in this string
                boolean thereIsaNbr = false;
                for  (GoBoardPosition nbr : nbrs) {
                    if (string.getMembers().contains(nbr)) {
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.