Examples of GoStone


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

            min = 3;
        int max = boardSize - (min-1);
        int mid = (boardSize >> 1) + 1;

        // add the star points
        GoStone handicapStone = new GoStone(true, HANDICAP_STONE_HEALTH);
        starPoints_.add( new GoBoardPosition( min, min, null, handicapStone.copy()) );
        starPoints_.add( new GoBoardPosition( max, max, null, handicapStone.copy()) );
        starPoints_.add( new GoBoardPosition( min, max, null, handicapStone.copy()) );
        starPoints_.add( new GoBoardPosition( max, min, null, handicapStone.copy()) );
        starPoints_.add( new GoBoardPosition( min, mid, null, handicapStone.copy()) );
        starPoints_.add( new GoBoardPosition( max, mid, null, handicapStone.copy()) );
        starPoints_.add( new GoBoardPosition( mid, min, null, handicapStone.copy()) );
        starPoints_.add( new GoBoardPosition( mid, max, null, handicapStone.copy()) );
        starPoints_.add( new GoBoardPosition( mid, mid, null, handicapStone) );
    }
View Full Code Here

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

     *   X X
     *   X X
     */
    public int formsBadShape(GoBoardPosition position)
    {
        GoStone stone = (GoStone)position.getPiece();
        int r = position.getRow();
        int c = position.getCol();

        return checkBadShape(stone, r, c,  1,-1)
             + checkBadShape(stone, r, c, -1,-1)
View Full Code Here

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

                correctNeighborType = nbrStone.isUnoccupied();
                break;
            case ENEMY: // the opposite color
                if (nbrStone.isUnoccupied())
                    return;
                GoStone st = (GoStone)nbrStone.getPiece();
                correctNeighborType =  st.isOwnedByPlayer1() != friendOwnedByP1;
                break;
            case FRIEND: // the same color
                if (nbrStone.isUnoccupied())
                    return;
                correctNeighborType = (nbrStone.getPiece().isOwnedByPlayer1() == friendOwnedByP1);
                break;
            case NOT_FRIEND: // the opposite color or empty
                GoStone stone = (GoStone)nbrStone.getPiece();
                correctNeighborType = (nbrStone.isUnoccupied() || stone.isOwnedByPlayer1() != friendOwnedByP1);
                break;
        }
        if (correctNeighborType ) {
            nbrs.add( nbrStone );
        }
View Full Code Here

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

     *  If the difference in health between the stones is great, then they are not really enemies
     *  because one of them is dead.
     */
    public boolean isTrueEnemy(GoBoardPosition pos) {
        assert (pos.isOccupied());
        GoStone stone = (GoStone)pos.getPiece();
        boolean muchWeaker = isStoneMuchWeakerThanGroup(stone);

        return ( stone.isOwnedByPlayer1() != group_.isOwnedByPlayer1() && !muchWeaker);
    }
View Full Code Here

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

           for ( int j = 1; j <= board_.getNumCols(); j++ ) {
               GoBoardPosition pos = (GoBoardPosition)board_.getPosition(i, j);
               pos.setScoreContribution(0);

               if (pos.isOccupied()) {
                   GoStone stone = ((GoStone)pos.getPiece());
                   stone.setHealth(0);
               }
           }
        }
    }
View Full Code Here

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

        GoBoardPosition stonePos = (GoBoardPosition)position;
        if (GameContext.getDebugMode() > 0)  {
            drawTerritoryShading(g2, position, cellSize, margin);
        }

        GoStone stone = (GoStone)position.getPiece();
        if (stone != null) {
            boolean inAtari = stonePos.isInAtari((GoBoard)board);
            drawStone(g2, position, cellSize, margin, inAtari, stone);
        }
    }
View Full Code Here

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

        super(viewer);

        GoController controller = (GoController) viewer.getController();
        if (!controller.getPlayers().allPlayersComputer()) {
            getRenderer().setDraggedShowPiece(
                    new GoBoardPosition(0, 0, null, new GoStone(controller.isPlayer1sTurn())));
            savedShowPiece_ = getRenderer().getDraggedShowPiece();
        }
    }
View Full Code Here

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

        GoBoard board = (GoBoard) controller.getBoard();
        boolean player1sTurn = controller.isPlayer1sTurn();

        GameContext.log( 3, "BoardViewer: mousePressed: player1sTurn()=" + player1sTurn);

        GoMove m = new GoMove( loc, 0, new GoStone(player1sTurn));

        // if there is already a piece where the user clicked, or its
        // out of bounds, or its a suicide move, then return without doing anything
        GoBoardPosition stone = (GoBoardPosition) board.getPosition( loc );
View Full Code Here

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

            getRenderer().setDraggedShowPiece(null);
        }
        else if (controller.getPlayers().allPlayersHuman()) {
            // create a stone to show for the next players move
            getRenderer().setDraggedShowPiece(
                    new GoBoardPosition(loc.getRow(), loc.getCol(), null, new GoStone(!player1sTurn)));
        }
    }
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.