Exemplo n.º 1
0
        public static string CardHandName(EvaluatorStrength es)
        {
            switch (es.HandType)
            {
            case Enums.HandType.StraightFlush:
                return("poker od " + CardModel.GetNormalize(es.WinCardList.First(), CardModel.NormalizeNominalSize.ONE));

            case Enums.HandType.Straight:
                return("strit od " + CardModel.GetNormalizeNominal(es.WinCardList.First().Face, CardModel.NormalizeNominalSize.ONE));

            case Enums.HandType.Flush:
                return("kolor " + CardModel.GetNormalizeSuit(es.WinCardList.First().Suit) + " do " + CardModel.GetNormalizeNominal(es.WinCardList.First().Face, CardModel.NormalizeNominalSize.ONE));

            case Enums.HandType.FullHouse:
                var kList = es.WinCardList.
                            GroupBy(g => g.Face).
                            OrderBy(g => g.Count()).
                            Select(g => new
                {
                    Face  = g.First().Face,
                    Count = g.Count()
                });
                return("fula " + CardModel.GetNormalizeNominal(kList.First().Face, CardModel.NormalizeNominalSize.MANY) + " na " + CardModel.GetNormalizeNominal(kList.Last().Face, CardModel.NormalizeNominalSize.MANY));

            case Enums.HandType.FourOfAKind:
                return("czwórkę " + CardModel.GetNormalizeNominal(es.WinCardList.First().Face, CardModel.NormalizeNominalSize.MANY));

            case Enums.HandType.ThreeOfAKind:
                return("trójkę " + CardModel.GetNormalizeNominal(es.WinCardList.First().Face, CardModel.NormalizeNominalSize.MANY));

            case Enums.HandType.TwoPair:
                var pList = es.WinCardList.
                            GroupBy(g => g.Face).
                            OrderBy(g => g.Count()).
                            Select(g => new
                {
                    Face  = g.First().Face,
                    Count = g.Count()
                });
                return("dwie pary, " + CardModel.GetNormalizeNominal(pList.First().Face, CardModel.NormalizeNominalSize.MANY) + " oraz " + CardModel.GetNormalizeNominal(pList.Last().Face, CardModel.NormalizeNominalSize.MANY));

            case Enums.HandType.Pair:
                return("parę " + CardModel.GetNormalizeNominal(es.WinCardList.First().Face, CardModel.NormalizeNominalSize.MANY));

            case Enums.HandType.HighCard:
                return("najwyższą kartę " + CardModel.GetNormalizeNominal(es.WinCardList.First().Face, CardModel.NormalizeNominalSize.ONE));
            }
            return("---Błąd---");
        }