Examples of NeighborAnalyzer


Examples of com.barrybecker4.game.twoplayer.go.board.analysis.neighbor.NeighborAnalyzer

        analyzerMap_ = analyzerMap;
    }

    public void setBoard(GoBoard board) {
        board_ = board;
        nbrAnalyzer_ = new NeighborAnalyzer(board);
        boundingBox_ = group_.findBoundingBox();
    }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.analysis.neighbor.NeighborAnalyzer

     * (expensive to check)
     * @param groups we will check each stone in each of these groups.
     */
    public void confirmAllStonesInGroupsClaimed(GoGroupSet groups) {

        NeighborAnalyzer na = new NeighborAnalyzer(board_);

        for (IGoGroup parentGroup : groups) {
            GoBoardPositionSet parentGroupStones = parentGroup.getStones();
            for (GoBoardPosition stone : parentGroupStones) {  // for each stone in that group
                // compute the group from this stone and confirm it matches the parent group
                GoBoardPositionList g = na.findGroupFromInitialPosition(stone);

                // perhaps we should do something more than check the size.
                if (g.size() != parentGroupStones.size()) {
                    groups.debugPrint(0, "Confirm stones in groups they Claim failed. \nGroups are:\n", true, true);
                    StringBuilder bldr = new StringBuilder();
                    bldr.append(board_.toString());
                    bldr.append("\n");
                    bldr.append("\n\nIt seems that using different seeds yields different groups:");
                    for (GoBoardPosition stone1 : parentGroupStones) {
                        GoBoardPositionList gg = na.findGroupFromInitialPosition(stone);
                        String title = "\nSEED STONE = "+ stone1 + " found groups of size " + gg.size();
                        bldr.append(gg.toString(title));
                    }
                    GameContext.log(0, bldr.toString());
                    GameContext.log(0,
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.analysis.neighbor.NeighborAnalyzer

     * @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) {
            if (pos.isOccupied()) {
                occupiedNbrs.add(pos);
            }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.analysis.neighbor.NeighborAnalyzer

        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();

            if (numEnemyNbrs == 3
                    || board.isOnEdge(pos) && numEnemyNbrs == 2
                    || board.isInCorner(pos) && numEnemyNbrs == 1) {
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.analysis.neighbor.NeighborAnalyzer

    public int numStonesAtaried(GoBoard board) {
        if ( isPassingMove() )
            return 0; // a pass cannot cause an atari

        GoBoardPosition pos = (GoBoardPosition)board.getPosition( getToRow(), getToCol() );
        NeighborAnalyzer na = new NeighborAnalyzer(board);
        GoBoardPositionSet enemyNbrs = na.getNobiNeighbors( pos, NeighborType.ENEMY );
        Iterator it = enemyNbrs.iterator();
        int numInAtari = 0;
        GoStringSet stringSet = new GoStringSet();
        while ( it.hasNext() ) {
            GoBoardPosition s = (GoBoardPosition) it.next();
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.analysis.neighbor.NeighborAnalyzer

     */
    PostChangeUpdater(GoBoard board, CaptureCounts captureCounter) {
        board_ = board;
        captureCounter_ = captureCounter;
        profiler_ = GoProfiler.getInstance();
        nbrAnalyzer_ = new NeighborAnalyzer(board);
        validator_ = new BoardValidator(board);
    }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.analysis.neighbor.NeighborAnalyzer

     */
    public GoBoard(GoBoard board) {
        super(board);

        handicap_ = board.handicap_;
        NeighborAnalyzer analyzer = new NeighborAnalyzer(this);
        analyzer.determineAllStringsOnBoard();
        groups_ = analyzer.findAllGroupsOnBoard();

        init(board.boardUpdater_.getCaptureCounts());
    }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.analysis.neighbor.NeighborAnalyzer

     * Adjust the liberties on the strings (both black and white) that we touch.
     * @param liberty either occupied or not depending on if we are placing the stone or removing it.
     */
    public void adjustLiberties(GoBoardPosition liberty) {

         NeighborAnalyzer na = new NeighborAnalyzer(this);
         GoStringSet stringNbrs = na.findStringNeighbors( liberty );
         for (IGoString sn : stringNbrs) {
            ((GoString)sn).changedLiberty(liberty);
         }
    }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.analysis.neighbor.NeighborAnalyzer

     */
    private GoBoardPositionLists getRestoredStringLists(GoBoard b) {

        GoBoardPositionList restoredList = getRestoredList(b);
        GoBoardPositionLists strings = new GoBoardPositionLists();
        NeighborAnalyzer nbrAnalyzer = new NeighborAnalyzer(b);
        for (GoBoardPosition s : restoredList) {
            if (!s.isVisited()) {
                GoBoardPositionList string1 = nbrAnalyzer.findStringFromInitialPosition(s, false);
                strings.add(string1);
            }
        }
        return strings;
    }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.go.board.analysis.neighbor.NeighborAnalyzer

    public EyeTypeAnalyzer(IGoEye eye, GoBoard board, GroupAnalyzer analyzer) {
        eye_ = eye;
        board_ = board;
        groupAnalyzer_ = analyzer;
        nbrAnalyzer_ = new NeighborAnalyzer(board);
    }
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.