// Multiplication (2) public static void Multiplication() { int nr1; int nr2; int answer; Console.Clear(); Console.ForegroundColor = ConsoleColor.White; Random random = new Random(); nr1 = random.Next(1, 11); nr2 = random.Next(1, 11); Console.WriteLine("{0} x {1} = ? ", nr1, nr2); Console.Read(); answer = Convert.ToInt32(Console.ReadLine()); if (answer == nr1 * nr2) { Console.Clear(); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.Write("Correct! "); Minigame.Win(); } else { Minigame.Lose(); } }
// Guess The Number (1) public static void GuessNumber() { int numberU = 1; int tryCount = 0; Random random = new Random(); int numberC = random.Next(1, 11); while (numberC != numberU) { Console.Clear(); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; Console.Write("Enter a number from "); Console.ForegroundColor = ConsoleColor.Green; Console.Write("1 "); Console.ForegroundColor = ConsoleColor.White; Console.Write("to "); Console.ForegroundColor = ConsoleColor.Green; Console.Write("10 "); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.Write("> "); Console.ForegroundColor = ConsoleColor.White; numberU = Convert.ToInt32(Console.ReadLine()); if (numberU < numberC) { Console.WriteLine(); Console.WriteLine("Too Low!"); Console.WriteLine("Try Again!"); System.Threading.Thread.Sleep(1000); } else if (numberU > numberC) { Console.WriteLine(); Console.WriteLine("Too High!"); Console.WriteLine("Try Again!"); System.Threading.Thread.Sleep(1000); } else { Console.Clear(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(); Console.WriteLine(numberC + "!"); System.Threading.Thread.Sleep(1000); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; Console.Write("It took you "); Console.ForegroundColor = ConsoleColor.Green; tryCount++; Console.Write(tryCount); Console.ForegroundColor = ConsoleColor.White; if (tryCount == 1) { Console.Write(" Try! Good guess!"); System.Threading.Thread.Sleep(1000); Console.ForegroundColor = ConsoleColor.Green; Console.Write(" +1"); Console.ForegroundColor = ConsoleColor.White; Console.Write("p Extra! "); System.Threading.Thread.Sleep(500); } else { Console.Write(" Tries."); } System.Threading.Thread.Sleep(1000); Minigame.Win(); } tryCount++; } }