Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace DragonRealm
- {
- class Program
- {
- static void displayIntro()
- {
- Console.WriteLine("You are in a land full of dragons. In front of you,");
- Console.WriteLine("you see two caves. In one cave, the dragon is friendly");
- Console.WriteLine("and will share his treasure with you. The other dragon");
- Console.WriteLine("is greedy and hungry, and will eat you on sight.");
- Console.WriteLine();
- }
- static string chooseCave()
- {
- string cave = "";
- while ((cave != "1") & (cave != "2"))
- {
- Console.WriteLine("Which cave will you go into? (1 or 2)");
- cave = Console.ReadLine();
- }
- return cave;
- }
- static void checkCave(string chosenCave)
- {
- Console.WriteLine("You approach the cave...");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(800);
- Console.WriteLine("It is dark and spooky...");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(800);
- Console.WriteLine("A large dragon jumps out infront of you! He opens his jaws and...");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1200);
- Random random = new Random();
- string friendlyCave = random.Next(1, 3).ToString();
- if (chosenCave == friendlyCave)
- {
- Console.WriteLine("Gives you his treasure!");
- }
- else
- {
- Console.WriteLine("Gobbles you down in one bite!");
- }
- }
- static void Main(string[] args)
- {
- string playAgain = "yes";
- while (playAgain == "yes")
- {
- Console.Clear();
- displayIntro();
- string CaveNumber = chooseCave();
- checkCave(CaveNumber);
- Console.WriteLine("Do you want to play again? (yes or no)");
- playAgain = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement