Exemple #1
0
    public static void hallCloset2()
    {
        //reuse code from original
        // initializing variables for the encounter
        int playerRoll = 0;
        int closetRoll = 0;
        var rand       = new Random();

        Console.WriteLine("As you open the closet door, you see a ghostly hand reach for you!");
        Console.WriteLine("Pick a number between 1 and 20, to see if you dodge the hand...: ");
        playerRoll = Int32.Parse(Console.ReadLine());
        closetRoll = 5 + rand.Next(1, 21);       // SHOULD generate a random integer between 1 and 20

        if (playerRoll > closetRoll)
        {
            Encounters.handSurvived();
        }
        else if ((playerRoll - closetRoll) <= -5)
        {
            Encounters.handDeath();
        }
        else
        {
            Encounters.handPassedThrough();
        }
    }