コード例 #1
0
        public static int Evaluate(BoardState board, int color, int openingPhase, int endingPhase, ref ulong fieldsAttackedByColor)
        {
            var mobility = KnightOperator.GetMobility(board, color, ref fieldsAttackedByColor) +
                           BishopOperator.GetMobility(board, color, ref fieldsAttackedByColor) +
                           RookOperator.GetMobility(board, color, ref fieldsAttackedByColor) +
                           QueenOperator.GetMobility(board, color, ref fieldsAttackedByColor);

            var mobilityOpeningScore = mobility * EvaluationConstants.Mobility;

            return(TaperedEvaluation.AdjustToPhase(mobilityOpeningScore, 0, openingPhase, endingPhase));
        }
コード例 #2
0
ファイル: MobilityEvaluator.cs プロジェクト: Tearth/Cosette
        public static int Evaluate(BoardState board, int color, int openingPhase, int endingPhase, ref ulong fieldsAttackedByColor)
        {
            var(knightCenter, knightOutside) = KnightOperator.GetMobility(board, color, ref fieldsAttackedByColor);
            var(bishopCenter, bishopOutside) = BishopOperator.GetMobility(board, color, ref fieldsAttackedByColor);
            var(rookCenter, rookOutside)     = RookOperator.GetMobility(board, color, ref fieldsAttackedByColor);
            var(queenCenter, queenOutside)   = QueenOperator.GetMobility(board, color, ref fieldsAttackedByColor);

            var centerMobility      = knightCenter + bishopCenter + rookCenter + queenCenter;
            var centerMobilityScore = centerMobility * EvaluationConstants.CenterMobilityModifier;

            var outsideMobility      = knightOutside + bishopOutside + rookOutside + queenOutside;
            var outsideMobilityScore = outsideMobility * EvaluationConstants.OutsideMobilityModifier;

            var openingScore = centerMobilityScore + outsideMobilityScore;

            return(TaperedEvaluation.AdjustToPhase(openingScore, 0, openingPhase, endingPhase));
        }