示例#1
0
        //тест на стрейт
        public void Test_6()
        {
            var Player_1 = new List <Card>();
            var Table    = new List <Card>();
            var num      = new List <int>()
            {
                0, 1, 2, 3, 4, 5, 6
            };
            var tmpDeck = new List <string>()
            {
                "C10", "HQ", "S8", "C9", "DJ", "H7", "S2"
            };
            var tmpDeck_1 = new List <string>();

            using (StreamWriter sw_1 = new StreamWriter("OutPut_6.txt", false, System.Text.Encoding.Default))
            {
                while (NextSet(num, num.Count))
                {
                    tmpDeck_1.Clear();
                    Player_1.Clear();
                    Table.Clear();
                    foreach (var item in num)
                    {
                        tmpDeck_1.Add(tmpDeck[item]);
                    }
                    for (int i = 0; i < 2; i++)
                    {
                        Player_1.Add(Card.Get(tmpDeck_1[i]));
                    }
                    for (int i = 0; i < 5; i++)
                    {
                        Table.Add(Card.Get(tmpDeck_1[i + 2]));
                    }
                    Combination combination = CombinationChecker.DetermineCombination(Player_1, Table);
                    //должна быть Стрит!
                    if (combination == Combination.Straight)
                    {
                        sw_1.WriteLine(combination);
                        sw_1.WriteLine("Player card :" + Player_1[0].ToString() + " " + Player_1[1].ToString());
                        sw_1.WriteLine("Table card :" + Table[0].ToString() + " " + Table[1].ToString() + " " + Table[2].ToString() + " " + Table[3].ToString() + " " + Table[4].ToString());
                    }
                }
            };
        }
示例#2
0
        //тест на рояль флеш
        public void Test_1()
        {
            var    Player_1 = new List <Card>();
            var    Table    = new List <Card>();
            var    tmpDeck  = new List <string>();
            var    TableWithOutFlashRoyal = new List <string>();
            Random rnd = new Random();
            bool   f   = false;
            int    k   = 0;

            string[] pwdRanc = new string[13] {
                "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"
            };
            string[] pwdSuit = new string[4] {
                "C", "D", "H", "S"
            };
            string[] FlashRoyal = new string[5] {
                "C10", "CJ", "CQ", "CK", "CA"
            };

            string str;

            for (var i = 0; i < 4; i++)
            {
                for (var j = 0; j < 13; j++)
                {
                    str = pwdSuit[i] + pwdRanc[j];
                    tmpDeck.Add(str);
                }
            }

            TableWithOutFlashRoyal.AddRange(tmpDeck);

            for (int i = 0; i < 5; i++)
            {
                var find = TableWithOutFlashRoyal.FindIndex(tmp => tmp == FlashRoyal[i]);
                TableWithOutFlashRoyal.RemoveAt(find);
            }
            foreach (var CurCard in FlashRoyal)
            {
                Table.Add(Card.Get(CurCard));
            }

            StreamWriter sw = new StreamWriter("OutPut.txt", false, System.Text.Encoding.Default);

            foreach (var FirstCard in TableWithOutFlashRoyal)
            {
                foreach (var SecondCard in TableWithOutFlashRoyal)
                {
                    if (FirstCard == SecondCard)
                    {
                        continue;
                    }
                    Player_1.Clear();
                    Player_1.Add(Card.Get(FirstCard));
                    Player_1.Add(Card.Get(SecondCard));

                    Combination combination = CombinationChecker.DetermineCombination(Player_1, Table);

                    {
                        if (combination != Combination.RoyalFlush)
                        {
                            sw.WriteLine(combination);
                            sw.WriteLine("Player card :" + Player_1[0].ToString() + " " + Player_1[1].ToString());
                            sw.WriteLine("Table card :" + Table[0].ToString() + " " + Table[1].ToString() + " " + Table[2].ToString() + " " + Table[3].ToString() + " " + Table[4].ToString());
                        }
                    };
                }
            }
        }