Beispiel #1
0
        private void CheckGuess(Player player)
        {
            string alertTitle = string.Empty;

            if (guessingGame.CheckGuess(player))
            {
                alertTitle = "You are right!";
            }
            else
            {
                alertTitle = "You are wrong...";
            }

            if (guessingGame.CanContinue)
            {
                ShowAlert(alertTitle, $"{player.FirstName} {player.LastName} has {player.FPPG} points.");
                guessingGame.SetUpTurn();
                SetUpUiForNextRound();
            }
            else
            {
                EndGame();
                ShowAlert(alertTitle, $"{player.FirstName} {player.LastName} has {player.FPPG} points.");
            }
        }
Beispiel #2
0
    public static void Main(string[] args)
    {
        GuessingGame userTry = new GuessingGame();

        int secret = userTry.GenerateSecret();
        int userInput;

        Console.WriteLine("I have a number between 1 and 1000." + "( " + secret + " )");
        Console.WriteLine("Please enter your first guess: ");
        userInput = Convert.ToInt32(Console.ReadLine());

        userTry.CheckGuess(userInput, secret);
    }