コード例 #1
0
        public static void Eval(ChessBoard cb, ThreadData threadData)
        {
            var mobilityScore = EvalUtil.CalculateMobilityScoresAndSetAttacks(cb);

            Console.WriteLine(" Material imbalance: " + EvalUtil.GetImbalances(cb, threadData.MaterialCache));
            Console.WriteLine("          Position : " + GetMgEgString(cb.PsqtScore));
            Console.WriteLine("          Mobility : " + GetMgEgString(mobilityScore));
            Console.WriteLine(" Pawn : " + EvalUtil.GetPawnScores(cb, threadData.PawnCache));
            Console.WriteLine("       Pawn-passed : " + GetMgEgString(PassedPawnEval.CalculateScores(cb)));
            Console.WriteLine("       Pawn shield : " + GetMgEgString(EvalUtil.CalculatePawnShieldBonus(cb)));
            Console.WriteLine("       King-safety : " + KingSafetyEval.CalculateScores(cb));
            Console.WriteLine("           Threats : " + GetMgEgString(EvalUtil.CalculateThreats(cb)));
            Console.WriteLine("             Other : " + EvalUtil.CalculateOthers(cb));
            Console.WriteLine("             Space : " + EvalUtil.CalculateSpace(cb));
            Console.WriteLine("-----------------------------");
            Console.WriteLine(" Total : " +
                              ChessConstants.ColorFactor[cb.ColorToMove] * EvalUtil.GetScore(cb, threadData));
        }
コード例 #2
0
        private static void CompareScores(ChessBoard cb1, ChessBoard cb2, int factor)
        {
            EvalUtil.CalculateMobilityScoresAndSetAttacks(cb1);
            EvalUtil.CalculateMobilityScoresAndSetAttacks(cb2);

            if (KingSafetyEval.CalculateScores(cb2) != KingSafetyEval.CalculateScores(cb1) * factor)
            {
                Console.WriteLine("Unequal king-safety: " + KingSafetyEval.CalculateScores(cb1) + " " +
                                  KingSafetyEval.CalculateScores(cb2) * factor);
            }

            if (EvalUtil.CalculatePositionScores(cb1) != EvalUtil.CalculatePositionScores(cb2) * factor)
            {
                Console.WriteLine("Unequal position score: " + EvalUtil.CalculatePositionScores(cb1) + " " +
                                  EvalUtil.CalculatePositionScores(cb2) * factor);
            }

            // if (EvalUtil.getPawnScores(cb1) != EvalUtil.getPawnScores(cb2) * factor) {
            // System.out.println("Unequal pawns: " + EvalUtil.getPawnScores(cb1) + " " + EvalUtil.getPawnScores(cb2) *
            // factor);
            // }
            // if (EvalUtil.getImbalances(cb1) != EvalUtil.getImbalances(cb2) * factor) {
            // System.out.println("Unequal imbalances: " + EvalUtil.getImbalances(cb1) + " " + EvalUtil.getImbalances(cb2) *
            // factor);
            // }
            if (EvalUtil.CalculateOthers(cb2) != EvalUtil.CalculateOthers(cb1) * factor)
            {
                Console.WriteLine("Unequal others: " + EvalUtil.CalculateOthers(cb1) + " " +
                                  EvalUtil.CalculateOthers(cb2) * factor);
            }

            if (EvalUtil.CalculateThreats(cb2) != EvalUtil.CalculateThreats(cb1) * factor)
            {
                Console.WriteLine("Unequal threats: " + EvalUtil.CalculateThreats(cb1) + " " +
                                  EvalUtil.CalculateThreats(cb2) * factor);
            }

            if (PassedPawnEval.CalculateScores(cb1) != PassedPawnEval.CalculateScores(cb2) * factor)
            {
                Console.WriteLine("Unequal passed-pawns: " + PassedPawnEval.CalculateScores(cb1) + " " +
                                  PassedPawnEval.CalculateScores(cb2) * factor);
            }
        }