Exemplo n.º 1
0
        public static BoardAnalysisDataDiff Diff(Board board1, Board board2, BoardAnalysisWeights weights)
        {
            BoardAnalysisData earlierBoardData;
            BoardAnalysisData laterBoardData;

            if (board1.turnNumber > board2.turnNumber)
            {
                earlierBoardData = BoardAnalysisData.GetBoardAnalysisData(board2, weights);
                laterBoardData   = BoardAnalysisData.GetBoardAnalysisData(board1, weights);
            }
            else
            {
                earlierBoardData = BoardAnalysisData.GetBoardAnalysisData(board1, weights);
                laterBoardData   = BoardAnalysisData.GetBoardAnalysisData(board2, weights);
            }

            var diff = new BoardAnalysisDataDiff();

            // el - early/late: comparing the earlier board with the later one on the same measure for the same color
            // bw - black/white: comparing the black versus the white on all four measures

            diff.el_articulationPointAdvantage    = laterBoardData.articulationPointDiff - earlierBoardData.articulationPointDiff;
            diff.el_hivailableAdvantage           = laterBoardData.hivailableSpaceDiff - earlierBoardData.hivailableSpaceDiff;
            diff.el_possibleMovesAdvantage        = laterBoardData.possibleMovesDiff - earlierBoardData.possibleMovesDiff;
            diff.el_queenBreathingSpacgeAdvantage = laterBoardData.queenBreathingSpaceDiff - earlierBoardData.queenBreathingSpaceDiff;
            diff.el_queenPlacementAdvantage       = laterBoardData.queenPlacementDiff - earlierBoardData.queenPlacementDiff;
            diff.el_unplayedPiecesAdvantage       = laterBoardData.unplayedPiecesDiff - earlierBoardData.unplayedPiecesDiff;

            return(diff);
        }
Exemplo n.º 2
0
        public static BoardAnalysisData GetBoardAnalysisData(Board board, BoardAnalysisWeights weights)
        {
            BoardAnalysisData d = new BoardAnalysisData();

            d._weights   = weights;
            d.gameResult = board.gameResult;
            d.blackArticulationPoints = board.articulationPoints.Count(p => p.color == PieceColor.Black);
            d.whiteArticulationPoints = board.articulationPoints.Count(p => p.color == PieceColor.White);

            IReadOnlyList <Move> moves = board.GetMoves(false);

            //IReadOnlyList<Move> moves = board.GenerateAllMovementMoves();
            d.blackPossibleMovementMoves = moves.Count(m => m.pieceToMove.color == PieceColor.Black);
            d.whitePossibleMovementMoves = moves.Count(m => m.pieceToMove.color == PieceColor.White);

            d.blackUnplayedPieces       = board.blackUnplayedPieces;
            d.whiteUnplayedPieces       = board.whiteUnplayedPieces;
            d.blackHivailableSpaces     = board.blackHivailableSpaces;
            d.whiteHivailableSpaces     = board.whiteHivailableSpaces;
            d.gameResult                = board.gameResult;
            d.whiteToPlay               = board.whiteToPlay;
            d.whiteQueenPlaced          = board.whiteQueenPlaced;
            d.blackQueenPlaced          = board.blackQueenPlaced;
            d.turnNumber                = board.turnNumber;
            d.blackQueenBreathingSpaces = board.BlackQueenBreathingSpaces();
            d.whiteQueenBreathingSpaces = board.WhiteQueenBreathingSpaces();
            d.whiteCanMoveAnt           = board.whiteCanMoveAnt;
            d.blackCanMoveAnt           = board.blackCanMoveAnt;
            d.whiteCanMoveQueen         = board.whiteCanMoveQueen;
            d.blackCanMoveQueen         = board.blackCanMoveQueen;
            d.whiteMoveablePieces       = board.whiteMoveablePieces;
            d.blackMoveablePieces       = board.blackMoveablePieces;
            d.blackOwnedBeetleStacks    = board.blackOwnedBeetleStacks;
            d.whiteOwnedBeetleStacks    = board.whiteOwnedBeetleStacks;

            return(d);
        }