示例#1
0
        public bool IsValid(List <DataContext.Card> cards)
        {
            var cards1 = new List <Card>();
            var cards2 = new List <Card>();
            var cards3 = new List <Card>();

            for (int i = 0; i < cards.Count; i += 3)
            {
                cards1.Add(cards[i]);
                cards2.Add(cards[i + 1]);
                cards3.Add(cards[i + 2]);
            }

            var isFlow = Identifier.Increase(cards1, 1, p => p.WeightValue);

            if (!isFlow)
            {
                return(false);
            }
            var isSame = Identifier.BeSame <Card, int>(cards1, cards2, p => p.WeightValue);

            if (!isSame)
            {
                return(false);
            }
            return(Identifier.BeSame <Card, int>(cards1, cards3, p => p.WeightValue));
        }
示例#2
0
 public bool IsValid(List <Card> cards)
 {
     if (cards.Count != 4)
     {
         return(false);
     }
     return(Identifier.BeSame <Card, int>(cards, p => p.WeightValue));
 }
示例#3
0
 public Formation.IFormation Parse(List <DataContext.Card> cards)
 {
     cards.Sort((p1, p2) => p1.WeightValue - p2.WeightValue);
     for (int continuousThreeIndex = 0; continuousThreeIndex <= 4; continuousThreeIndex++)
     {
         if (Identifier.BeSame(cards, continuousThreeIndex, 4, p => p.WeightValue))
         {
             return(GetFormation(cards, continuousThreeIndex));
         }
     }
     return(null);
 }
示例#4
0
        public Formation.IFormation Parse(List <DataContext.Card> cards)
        {
            var continuousThreeIndex = 0;

            cards.Sort((p1, p2) => p1.WeightValue - p2.WeightValue);
            if (Identifier.BeSame(cards, 0, 3, p => p.WeightValue))
            {
                continuousThreeIndex = 0;
            }
            else if (Identifier.BeSame(cards, 1, 3, p => p.WeightValue))
            {
                continuousThreeIndex = 1;
            }
            else if (Identifier.BeSame(cards, 2, 3, p => p.WeightValue))
            {
                continuousThreeIndex = 2;
            }
            return(GetFormation(cards, continuousThreeIndex));
        }
示例#5
0
        public bool IsValid(List <DataContext.Card> cards)
        {
            var evenCards = new List <Card>();
            var oddCards  = new List <Card>();

            for (int i = 0; i < cards.Count; i += 2)
            {
                evenCards.Add(cards[i]);
                oddCards.Add(cards[i + 1]);
            }


            var isFlow = Identifier.Increase(evenCards, 1, p => p.WeightValue);

            if (!isFlow)
            {
                return(false);
            }
            return(Identifier.BeSame <Card, int>(evenCards, oddCards, p => p.WeightValue));
        }
示例#6
0
 public bool IsValid(List <DataContext.Card> cards)
 {
     return(Identifier.BeSame <Card, int>(cards, p => p.WeightValue));
 }