Examples of GoStone


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

        Point point = argument.m_point;

        if (point != null)  {
            boolean isBlack = controller_.getCurrentPlayer().equals(controller_.getPlayers().getPlayer1());
            GoMove move = new GoMove(new ByteLocation(point.getX()+1, point.getY()+1)0, new GoStone(isBlack));
            controller_.manMoves(move);
        }
        return true;
    }
View Full Code Here

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

        for ( int row = 1; row <= board_.getNumRows(); row++ ) {
            for ( int col = 1; col <= board_.getNumCols(); col++ ) {
                GoBoardPosition space = (GoBoardPosition)board_.getPosition( row, col );
                if (space.isOccupied())  {
                    GoStone stone = (GoStone)space.getPiece();
                    int side = (stone.isOwnedByPlayer1() ? 1: -1);
                    GameContext.log(1, "life & death: "+space+" health="+stone.getHealth());
                    if (side*stone.getHealth() < 0)  {
                        // then the stone is more dead than alive, so mark it so
                        GameContext.log(0, "setting " + space + " to dead");
                        stone.setDead(true);
                        deadStones_.increment(space.getPiece().isOwnedByPlayer1());
                    }
                }
            }
        }
View Full Code Here

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

     * Constructor.
     * Create a new string containing the specified list of stones
     */
    public GoString( GoBoardPositionList stones, GoBoard board ) {
        assert (stones != null && stones.size() > 0): "Tried to create list from empty list";
        GoStone stone =  (GoStone)stones.getFirst().getPiece();
        // GoEye constructor calls this method. For eyes the stone is null.
        if (stone != null)
            ownedByPlayer1_ = stone.isOwnedByPlayer1();
        for (GoBoardPosition pos : stones) {
            addMemberInternal(pos, board);
        }
        libertyAnalyzer_ = new StringLibertyAnalyzer(board, this);
    }
View Full Code Here

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

     * @param health range = [0-1]
     */
    @Override
    public final void updateTerritory( float health ) {
        for (GoBoardPosition pos : getMembers()) {
            GoStone stone = (GoStone) pos.getPiece();
            stone.setHealth(health);
        }
    }
View Full Code Here

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

     */
    @Override
    public boolean isEnemy(GoBoardPosition pos) {
        assert (group_ != null): "group for "+this+" is null";
        assert (pos.isOccupied()): "pos not occupied: ="+pos;
        GoStone stone = (GoStone)pos.getPiece();
        //boolean stoneMuchWeaker = getGroup().isStoneMuchWeaker(stone);

        assert (getGroup().isOwnedByPlayer1() == isOwnedByPlayer1()): getGroup() + " string=" + this;
        return stone.isOwnedByPlayer1() != isOwnedByPlayer1(); // && !stoneMuchWeaker);
    }
View Full Code Here

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

        for (int i = 1; i <= nCols; i++ )  {
            for (int j = 1; j <= nRows; j++ )  {
                // if its a candidate move and not an immediate take-back (which would break the rule of ko)
                if ( candidateMoves.isCandidateMove( j, i ) && !isTakeBack( j, i, (GoMove) lastMove, board ) ) {
                    GoMove m = new GoMove( new ByteLocation(j, i), lastMoveValue, new GoStone(player1) );

                    if ( m.isSuicidal(board) ) {
                        GameContext.log(3, "The move was a suicide (can't add it to the list): " + m);
                    }
                    else {
View Full Code Here

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

     *  because one of them is dead.
     */
    @Override
    public boolean isEnemy( GoBoardPosition pos) {
        assert (pos.isOccupied());
        GoStone stone = (GoStone)pos.getPiece();
        return stone.isOwnedByPlayer1() != isOwnedByPlayer1(); // && !muchWeaker);
    }
View Full Code Here

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

        IGoGroup g = getGroup();
        assert (g != null): "group for "+ this +" is null";
        if (pos.isUnoccupied()) {
            return false;
        }
        GoStone stone = (GoStone)pos.getPiece();

        assert (g.isOwnedByPlayer1() == isOwnedByPlayer1()):
                 "Bad group ownership for eye="+ this +". Owning Group="+g;
        return (stone.isOwnedByPlayer1() != isOwnedByPlayer1()); // && !weaker);
    }
View Full Code Here

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

        boolean player1 = token instanceof AddBlackToken;

        while (points.hasNext()) {
            Point point = points.next();
            //System.out.println("adding move at row=" + point.y+" col="+ point.x);
            moveList.add( new GoMove( new ByteLocation(point.y, point.x), 0, new GoStone(player1)));
        }
    }
View Full Code Here

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

          if (mvToken.isPass()) {
              return GoMove.createPassMove(0, !mvToken.isWhite());
          }
          return new GoMove(
                  new ByteLocation(mvToken.getY(), mvToken.getX()),
                  0, new GoStone(!mvToken.isWhite()));
    }
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.