Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created January 9, 2021 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/fe28f50755f016289230100c083f182d to your computer and use it in GitHub Desktop.
Save codecademydev/fe28f50755f016289230100c083f182d to your computer and use it in GitHub Desktop.
Codecademy export
using System;
namespace ChooseYourOwnAdventure
{
class Program
{
static void Main(string[] args)
{
/* THE MYSTERIOUS NOISE */
// Start by asking for the user's name:
Console.Write("What is your name?: ");
string name = Console.ReadLine();
Console.WriteLine($"Hello, {name}! Welcome to our story.");
Console.WriteLine("It begins on a cold rainy night.");
Console.WriteLine("You're sitting in your room and hear a noise coming from down the hall.");
Console.WriteLine("Do you go investigate?");
Console.Write("Enter YES or NO: ");
string noiseChoice = Console.ReadLine();
string choice = noiseChoice.ToUpper();
if (choice == "YES")
{
Console.WriteLine("You walk into the hallayand see a light coming from under a door down the hall.");
Console.WriteLine("You walk towards it.Do you open it or knock?");
}
else if (choice =="NO")
{
Console.WriteLine("End of Game! Bye!");
}
Console.Write("Typer OPEN or KNOCK: ");
string doorChoice = Console.ReadLine();
string choice1 = doorChoice.ToUpper();
if(choice1 == "KNOCK")
{
Console.WriteLine("A voice behind the door speaks.") ;
Console.WriteLine("It says, Answer this riddle:");
Console.WriteLine("Poor people have it. Rich people need it.If you eat it you die. What is it?");
}
else if(choice1 =="OPEN")
{
Console.WriteLine("The door is locked! See if one of your three keys will open it.");
}
Console.Write("Type your answer: ");
Console.ReadLine();
string riddleAnswer = "NOTHING";
if (riddleAnswer == "NOTHING")
{
Console.WriteLine("The door opens and NOTHING is there.");
Console.WriteLine("You turn off the light and run back to your room and lock the door.THE END.");
}
else
{
Console.WriteLine("You answered incorrectly.The door doesn't open.THE END.");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment