public static void ShowNumbers(NumbersIndexator numbers) { for (int i = 0; i < 6; i++) { Console.Write(numbers.Get(i) + " "); } }
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(); } }
static void Main(string[] args) { NumbersIndexator userNumbers = new NumbersIndexator(GetNumbers()); NumbersIndexator randomNumbers = new NumbersIndexator(GenerateRandomNumbers()); CheckWin(userNumbers, randomNumbers); Console.ReadLine(); }