示例#1
0
        static void Main(string[] args)
        {
            LotteryTicket random = new LotteryTicket(0, 0, 0, 0, 0, 0);

            random.RandomNumberGener();

            Console.WriteLine("Willkommen zur heutigen Lotto ziehung! \n Bitte geben Sie Ihre Glückszahlen ein: 1 - 9");
            Console.WriteLine("Glückszahl 1:");
            int LuckyNumberOne = Console.ReadLine().ReadInt();

            Console.WriteLine("Glückszahl 2:");
            int LuckyNumberTwo = Console.ReadLine().ReadInt();

            Console.WriteLine("Glückszahl 3:");
            int LuckyNumberThree = Console.ReadLine().ReadInt();

            Console.WriteLine("Glückszahl 4:");
            int LuckyNumberFour = Console.ReadLine().ReadInt();

            Console.WriteLine("Glückszahl 5:");
            int LuckyNumberFive = Console.ReadLine().ReadInt();

            Console.WriteLine("Glückszahl 6:");
            int           LuckyNumberSix = Console.ReadLine().ReadInt();
            LotteryTicket lotteryTicket  = new LotteryTicket(LuckyNumberOne, LuckyNumberTwo, LuckyNumberThree, LuckyNumberFour, LuckyNumberFive, LuckyNumberSix);

            Console.WriteLine($"Ihre Glückszahlen sind: \n{lotteryTicket.ToString()}\n");



            if (random.LuckynumberChecker(random, lotteryTicket))
            {
                Console.WriteLine("\nConnGratzz!!!");
                Console.WriteLine($"Die heutige Zahlen sind: \n {random.ToString()}");
            }
            else
            {
                Console.WriteLine($"\nHeute Leider nicht den JackPot Gekanckt \nDie heutige Zahlen sind: \n{random.ToString()}");
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            LotteryTicket lotteryTicket = new LotteryTicket();
            Coupon        newCoupon     = new Coupon();

            do
            {
                int        money = START;
                int        day   = 0;
                ConsoleKey choose;
                do
                {
                    cumulation = random.Next(2, 33) * 1000000;
                    day++;
                    int tickets = 0;
                    do
                    {
                        Console.Clear();
                        Console.WriteLine("Day: {0}", day);
                        Console.WriteLine("Welcome to the Lotto game, today you can win {0}", cumulation);
                        Console.Write("\nYour account balance: {0}$", money);
                        Console.WriteLine("");
                        newCoupon.ShowCoupon();

                        //MENU
                        if (money >= 4 && tickets < 6)
                        {
                            Console.WriteLine("\n1 - Buy one lottery ticket - 4$ [{0}/6]", tickets + 1);
                        }
                        Console.WriteLine("2 - Check coupon - Lotto draw");
                        Console.WriteLine("3 - End of the Game.");
                        //MENU
                        choose = Console.ReadKey().Key;
                        if (choose == ConsoleKey.D1 && money > 4 && tickets < 6)
                        {
                            newCoupon.CouponList.Add(lotteryTicket.UseLotteryTicket());
                            money -= 4;
                            tickets++;
                        }
                    } while (choose == ConsoleKey.D1);
                    Console.Clear();
                    if (newCoupon.CouponList.Count > 0)
                    {
                        int win = check(newCoupon);
                        if (win > 0)
                        {
                            Console.ForegroundColor = ConsoleColor.Yellow;
                            Console.WriteLine("You WIN {}", win);
                            Console.ResetColor();
                            money += win;
                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.WriteLine("Unfortunately, you didn't win.");
                            Console.ResetColor();
                        }
                    }
                    else
                    {
                        Console.WriteLine("You don't have tickets for this draw.");
                    }
                    Console.WriteLine("Enter - continue.");
                    Console.ReadKey();
                } while (money >= 4 && choose != ConsoleKey.D3);

                Console.Clear();
                Console.WriteLine("Day {0}. \n End of the game, your score is: {1}", day, money - START);
                Console.WriteLine("Press Enter to continue.");
            } while (Console.ReadKey().Key == ConsoleKey.Enter);
        }