예제 #1
0
        public IScore Score(Hand hand)
        {
            var Cards = hand.Cards;
            CompositeScore handScore = new CompositeScore();

            var sets = (from c in Cards
                        group c by c.Value
                        into g
                            orderby g.Key
                            select new ValueSet{ Value = g.Key, Count = g.Count() }).ToList();

            var suits = (from c in Cards
                         group c by c.Suit
                         into g
                             where g.Count() == 5
                             select new SuitSet {Suit = g.Key, Count = g.Count(), High = g.Max(c => c.Value)}).
                FirstOrDefault();

            //linq-terbation?
            var scores = (from m in HandEvaluationMap.Map
                         from s in sets
                         where m.Condition(s, suits, sets)
                         select m.ScoreFactory(s, suits, sets)).ToList();

            scores.ForEach(handScore.Add);

            return handScore;
        }
예제 #2
0
        /// <summary>輸出用於MessageBox之類臨時顯示的字串</summary>
        /// <returns></returns>
        public string ToScoreLine()
        {
            string output = "";

            output += Subject + "_" + SubjectState + "_" + RegionId + "_" + TopDown;
            output += "\t勾縫分數:\t" + GS.ToString("00.0");
            output += "\t平行分數:\t" + LPS.ToString("00.0");
            output += "\t筆直分數:\t" + LSS.ToString("00.0");
            output += "\t轉角分數:\t" + AS.ToString("00.0");
            output += "\t綜合分數:\t" + CompositeScore.ToString("00.0");
            output += "\t方林分數:\t" + FangLingScore.ToString("00.0");
            //output += "\t林的分數(修):\t" + scoreOfLinM.ToString("00.0");
            //output += "\t角Y方向離差:\t" + CornerResidualY.ToString();
            //output += "\t角X方向離差:\t" + CornerResidualX.ToString();
            return(output);
        }