コード例 #1
0
        public double CalculateSearchScore()
        {
            double TurnedOverCardScore = Coefficients[0];
            double SpaceScore          = Coefficients[1];
            double FacesMatchScore     = 1;
            double SuitsMatchScore     = Coefficients[2];
            double DiscardedScore      = Coefficients[3];

            double score = 0;

            for (int column = 0; column < NumberOfPiles; column++)
            {
                Pile pile = WorkingTableau[column];
                if (pile.Count == 0)
                {
                    score += SpaceScore;
                }
                else if (pile.Count == 1 && pile[0].IsEmpty)
                {
                    score += TurnedOverCardScore + 5 - Tableau.GetDownCount(column);
                }
                else
                {
                    for (int row = 1; row < pile.Count; row++)
                    {
                        int order = GetOrder(pile[row - 1], pile[row]);
                        if (order == 1)
                        {
                            score += FacesMatchScore;
                        }
                        else if (order == 2)
                        {
                            score += SuitsMatchScore;
                        }
                    }
                }
            }
            score += DiscardedScore * WorkingTableau.DiscardPiles.Count;
            return(score);
        }