Package com.barrybecker4.game.twoplayer.go.board.elements.position

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


     * If the player at this new table is already sitting at another table,
     * remove him from the other tables(s) and delete those other tables (if no one else is there).
     */
    void joinTable(OnlineGameTable table) {

        Player p = table.getNewestHumanPlayer();

        tables_.removePlayer(p);
        tables_.join(table.getName(), p);
    }
View Full Code Here


        Box innerBox = createBoxExcludingBorder(boundingBox_);
        for ( int r = innerBox.getMinRow(); r < innerBox.getMaxRow(); r++ ) {
            for ( int c = innerBox.getMinCol(); c < innerBox.getMaxCol(); c++ ) {

                // if the empty space is already marked as being an eye, skip
                GoBoardPosition space = (GoBoardPosition) board_.getPosition( r, c );
                assert space != null : "pos r="+r +" c="+c;
                if ( !space.isVisited() && space.isUnoccupied() && !space.isInEye() ) {
                    GoBoardPositionList eyeSpaces =
                            nbrAnalyzer_.findStringFromInitialPosition( space, ownedByPlayer1,
                                                                 false, NeighborType.NOT_FRIEND,
                                                                 boundingBox_  );
                    excludedSpaceLists.add(eyeSpaces);
View Full Code Here

            Iterator it = exclusionList.iterator();
            GroupAnalyzer groupAnalyzer = analyzerMap_.getAnalyzer(group_);

            while (it.hasNext()) {
                GoBoardPosition p = (GoBoardPosition)it.next();
                if (p.isOccupied()) {
                    // if its a very weak opponent (ie dead) then don't exclude it from the list
                    if (!groupAnalyzer.isTrueEnemy(p))  {
                        p.setVisited(false);
                        it.remove()// remove it from the list
                    }
                }
            }
View Full Code Here

    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

    /**
     * verify that all the stones are marked unvisited.
     */
    public void confirmAllUnvisited() {

        GoBoardPosition stone = areAllUnvisited();
        if (stone != null)
           assert false : stone + " is marked visited";
    }
View Full Code Here

     */
    private GoBoardPosition areAllUnvisited()  {

        for ( int i = 1; i <= board_.getNumRows(); i++ ) {
            for ( int j = 1; j <= board_.getNumCols(); j++ ) {
                GoBoardPosition stone = (GoBoardPosition) board_.getPosition( i, j );
                if (stone.isVisited())
                    return stone;
            }
        }
        return null;
    }
View Full Code Here

    public static void confirmNoNullMembers(GoGroup group) {
        Iterator it = group.getStones().iterator();
        boolean failed = false;
        while (it.hasNext()) {
            GoBoardPosition s = (GoBoardPosition)it.next();
            if (s.getPiece()==null) failed = true;
        }
        if (failed) {
            assert false : "Group contains an empty position: "+group.toString();
        }
    }
View Full Code Here

     * Determine if the last move caused atari on another group (without putting ourselves in atari).
     * @param lastMovePlayed last position just played.
     * @return true if the lastMovePlayed puts the lastPositions string in atari.
     */
    private boolean putsGroupInAtari(GoMove lastMovePlayed) {
        GoBoardPosition lastPos = (GoBoardPosition) board_.getPosition(lastMovePlayed.getToLocation());
        return (lastMovePlayed.numStonesAtaried(board_) >= CRITICAL_GROUP_SIZE
                && lastPos.getString().getNumLiberties(board_) > 1);
    }
View Full Code Here

     * However, if you kill an enemy string by playing on your last liberty,
     * then it is legal.
     * @return true if this move is suicidal.
     */
    public boolean isSuicidal( GoBoard board ) {
        GoBoardPosition stone = (GoBoardPosition) board.getPosition( getToRow(), getToCol() );

        NeighborAnalyzer na = new NeighborAnalyzer(board);
        GoBoardPositionSet nobiNbrs = na.getNobiNeighbors(stone, false, NeighborType.ANY);
        GoBoardPositionSet occupiedNbrs = new GoBoardPositionSet();
        for (GoBoardPosition pos : nobiNbrs) {
View Full Code Here

     */
    public boolean isKo(GoBoard board) {

        if (getNumCaptures() == 1) {
            //GoBoardPosition capture = (GoBoardPosition) getCaptures().getFirst();
            GoBoardPosition pos = (GoBoardPosition) board.getPosition(getToLocation());

            NeighborAnalyzer nbrAnal = new NeighborAnalyzer(board);
            GoBoardPositionSet enemyNbrs = nbrAnal.getNobiNeighbors(pos, isPlayer1(), NeighborType.ENEMY);
            int numEnemyNbrs = enemyNbrs.size();

View Full Code Here

TOP

Related Classes of com.barrybecker4.game.twoplayer.go.board.elements.position.GoBoardPosition

Copyright © 2018 www.massapicom. 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.