Пример #1
0
        static void Main(string[] args)
        {
            string pattern = @"^\d*$";
            Regex  rgx = new Regex(pattern);
            String min, max;

            for (; ;)
            {
                Console.Write("Enter min value:\n >> ");
                min = Validator.ReadString();
                Console.Write("Enter max value:\n >> ");
                max = Validator.ReadString();
                if (!LuckyTicket.CheckTicketNum(max) || !LuckyTicket.CheckTicketNum(min) || (Int32.Parse(min) > Int32.Parse(max)))
                {
                    Output.Message("Ticket has wrong format, try again\n", ConsoleColor.Red);
                    continue;
                }
                else
                {
                    LuckyTicket.TestMethods(min, max);
                    break;
                }
            }
            Console.Read();
        }
Пример #2
0
        public static void TestMethods(String min, String max)
        {
            int    count = Int32.Parse(min), simpleCount = 0, complexCount = 0;
            String current = min;

            while (count != Int32.Parse(max))
            {
                if (LuckyTicket.Simple(LuckyTicket.ConvertTicket(current)))
                {
                    simpleCount++;
                }
                if (LuckyTicket.Complex(LuckyTicket.ConvertTicket(current)))
                {
                    complexCount++;
                }
                count++;
                current = count.ToString();
            }
            Output.Message("Simple: " + simpleCount + ", Complex: "
                           + complexCount + (simpleCount > complexCount ? "\nSimple wins!" : "\nComplex wins!"),
                           ConsoleColor.Yellow);
        }