コード例 #1
0
        public double EvaluatePosition(MoveTreeNode moveTree, PieceDict myPieces, PieceDict theirPieces, int moveNumber)
        {
            double myPoints    = EvaluatePieces(myPieces);
            double theirPoints = EvaluatePieces(theirPieces);

            return(myPoints - theirPoints);
        }
コード例 #2
0
        public double EvaluatePosition(MoveTreeNode moveTree, PieceDict myPieces, PieceDict theirPieces, int moveCount)
        {
            double pawnValue   = 0; // pawnEvaluator.EvaluatePosition(myPieces, theirPieces, moveCount);
            double rookValue   = rookEvaluator.EvaluatePosition(moveTree, myPieces, theirPieces, moveCount);
            double bishopValue = bishopEvaluator.EvaluatePosition(moveTree, myPieces, theirPieces, moveCount);
            double knightValue = knightEvaluator.EvaluatePosition(moveTree, myPieces, theirPieces, moveCount);
            double queenValue  = queenEvaluator.EvaluatePosition(moveTree, myPieces, theirPieces, moveCount);

            return(pawnValue + rookValue + bishopValue + knightValue + queenValue);
        }
コード例 #3
0
        public double EvaluatePosition(MoveTreeNode moveTree, PieceDict myPieces, PieceDict theirPieces, int moveNumber)
        {
            var    myQueens   = myPieces[PieceType.Queen];
            double queenValue = 0.0;

            foreach (var r in myQueens)
            {
                queenValue += EvaluatePiece(moveTree, r, moveNumber);
            }
            return(queenValue);
        }
コード例 #4
0
        private PieceDict ConvertPieceListToDict(Board board, IEnumerable <ChessPiece> pieces)
        {
            var pieceDict = new PieceDict();

            foreach (var piece in pieces)
            {
                if (!pieceDict.ContainsKey(piece.Type))
                {
                    pieceDict.Add(piece.Type, new List <ChessPiece>());
                }
                pieceDict[piece.Type].Add(piece);
            }
            return(pieceDict);
        }
コード例 #5
0
        public double EvaluatePosition(MoveTreeNode moveTree, PieceDict myPieces, PieceDict theirPieces, int moveNumber)
        {
            var    myRooks   = myPieces[PieceType.Rook];
            double rookValue = 0.0;

            foreach (var r in myRooks)
            {
                rookValue += EvaluatePiece(moveTree, r, moveNumber);
            }
            if (myRooks.Count >= 2)
            {
                rookValue += DOUBLE_ROOK_BONUS;
            }
            return(rookValue);
        }
コード例 #6
0
        public double EvaluatePosition(MoveTreeNode moveTree, PieceDict myPieces, PieceDict theirPieces, int moveNumber)
        {
            var    myKnights   = myPieces[PieceType.Knight];
            double knightValue = 0.0;

            foreach (var r in myKnights)
            {
                knightValue += EvaluatePiece(moveTree, r, moveNumber);
            }
            if (myKnights.Count >= 2)
            {
                knightValue += DOUBLE_KNIGHT_BONUS;
            }
            return(knightValue);
        }
コード例 #7
0
        public double EvaluatePosition(MoveTreeNode moveTree, PieceDict myPieces, PieceDict theirPieces, int moveNumber)
        {
            var myPawns    = myPieces[PieceType.Pawn].ToList();
            var theirPawns = theirPieces[PieceType.Pawn].ToList();

            double pawnScore = 0.0;

            foreach (var p in myPawns)
            {
                var pawnEval = EvaluatePawn(p, myPawns, theirPawns);
                pawnScore += pawnEval.TotalValue;
            }

            return(pawnScore);
        }
コード例 #8
0
        public double EvaluatePosition(MoveTreeNode moveTree, PieceDict myPieces, PieceDict theirPieces, int moveNumber)
        {
            var    myBishops   = myPieces[PieceType.Bishop];
            double bishopValue = 0.0;

            foreach (var r in myBishops)
            {
                bishopValue += EvaluatePiece(r, moveTree, moveNumber);
            }
            if (myBishops.Count >= 2)
            {
                bishopValue += DOUBLE_BISHOP_BONUS;
            }
            return(bishopValue);
        }
コード例 #9
0
        private double EvaluatePieces(PieceDict pieces)
        {
            var pawns   = pieces[PieceType.Pawn];
            var rooks   = pieces[PieceType.Rook];
            var knights = pieces[PieceType.Knight];
            var bishops = pieces[PieceType.Bishop];
            var queens  = pieces[PieceType.Queen];
            var kings   = pieces[PieceType.King];

            double pawnValue    = pawns.Count * PAWN_VAL;
            double rookValue    = rooks.Count * ROOK_VAL;
            double knightValue  = knights.Count * KNIGHT_VAL;
            double bishopsValue = bishops.Count * BISHOP_VAL;
            double queensValue  = queens.Count * QUEEN_VAL;
            double kingsValue   = kings.Count * KING_VAL;

            return(pawnValue + rookValue + knightValue + bishopsValue + queensValue + kingsValue);
        }