Example #1
0
        public static void CheckWin(NumbersIndexator userNumbers, NumbersIndexator randomNumbers)
        {
            bool winFlag = false;

            for (int i = 0; i < 6; i++)
            {
                winFlag = false;
                for (int j = 0; j < 6; j++)
                {
                    if (userNumbers.Get(i) == randomNumbers.Get(j))
                    {
                        winFlag = true;
                        break;
                    }
                }
                if (!winFlag)
                {
                    Console.WriteLine("You didn`t win. Victorious combination was: ");
                    ShowNumbers(randomNumbers);
                    break;
                }
            }
            if (winFlag)
            {
                Console.BackgroundColor = ConsoleColor.Yellow;
                Console.ForegroundColor = ConsoleColor.Black;
                Console.WriteLine("Congratulations you won");
                Console.ResetColor();
            }
        }
Example #2
0
 public static void ShowNumbers(NumbersIndexator numbers)
 {
     for (int i = 0; i < 6; i++)
     {
         Console.Write(numbers.Get(i) + " ");
     }
 }