コード例 #1
0
ファイル: ComputerPlayer.cs プロジェクト: qsLampard/CardLib
 private void DealwithStraight(kindsOfCombination combination, int CardPlayer)
 {
     for (int i = 0; i < Hand.Count; i++)
     {
         if (Chosen.Count == 0)
         {
             if (Hand[i].rank > (Rank)combination.index)
             {
                 Chosen.Add(Hand[i]);
             }
         }
         else if (Hand[i].rank == Chosen.Last().rank + 1 && Hand[i].rank < (Rank)15)
         {
             Chosen.Add(Hand[i]);
         }
         else if (Hand[i].rank > Chosen.Last().rank + 1)
         {
             Chosen.Clear();
         }
         if (Chosen.Count == combination.assist)
         {
             break;
         }
     }
     if (Chosen.Count != combination.assist)
     {
         Chosen.Clear();
     }
     if (Chosen.Count == 0 && combination.assist >= 7) //use bomb
     {
         DealwithBomb(combination, CardPlayer);
     }
 }
コード例 #2
0
ファイル: ComputerPlayer.cs プロジェクト: qsLampard/CardLib
        private void DealwithStraightPair(kindsOfCombination combination, int CardPlayer)
        {
            bool chooseFirst = true;

            for (int i = 0; i < Hand.Count - 3; i++)
            {
                if (Chosen.Count == 0)
                {
                    if (Hand[i].rank > (Rank)combination.index)
                    {
                        Chosen.Add(Hand[i]);
                    }
                }
                else if (chooseFirst && Hand[i].rank == Chosen.Last().rank&& Hand[i].rank < (Rank)15)
                {
                    chooseFirst = false;
                    Chosen.Add(Hand[i]);
                }
                else if (chooseFirst && Hand[i].rank > Chosen.Last().rank&& Hand[i].rank < (Rank)15)
                {
                    Chosen.Clear();
                }
                else if (!chooseFirst && Hand[i].rank == Chosen.Last().rank + 1 && Hand[i].rank < (Rank)15)
                {
                    chooseFirst = true;
                    Chosen.Add(Hand[i]);
                }
                else if (!chooseFirst && Hand[i].rank > Chosen.Last().rank + 1)
                {
                    Chosen.Clear();
                }
                if (Chosen.Count == combination.assist)
                {
                    break;
                }
            }
            if (Chosen.Count != combination.assist * 2)
            {
                Chosen.Clear();
            }
            if (Chosen.Count == 0 && combination.assist >= 4) //use bomb
            {
                DealwithBomb(combination, CardPlayer);
            }
        }