-
Notifications
You must be signed in to change notification settings - Fork 0
/
C#
72 lines (71 loc) · 2.52 KB
/
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System;
namespace ChooseYourOwnAdventure
{
class Program
{
static void Main(string[] args)
{
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. You're sitting in your room and hear a noise coming from down the hall. Do you go investigate?");
Console.Write("Type YES or NO: ");
string noiseChoice = Console.ReadLine();
noiseChoice = noiseChoice.ToUpper();
if (noiseChoice == "NO")
{
Console.WriteLine("Not much of an adventure if we don't leave our room!");
Console.WriteLine("THE END.");
}
else if (noiseChoice == "YES")
{
Console.WriteLine("You walk into the hallway and see a light coming from under a door down the hall. You walk towards it. Do you open it or knock?");
Console.WriteLine("Type OPEN or KNOCK:");
string doorChoice = Console.ReadLine();
doorChoice = doorChoice.ToUpper();
if (doorChoice == "KNOCK")
{
Console.WriteLine("A voice behind the door speaks. It says, \"Answer this riddle: \"");
Console.WriteLine("\"Poor people have it. Rich people need it. If you eat it you die. What is it?\"");
Console.Write("Type your answer:");
string riddleAnswer = Console.ReadLine();
riddleAnswer = riddleAnswer.ToUpper();
if (riddleAnswer == "NOTHING")
{
Console.WriteLine("The door opens and NOTHING is there.");
Console.WriteLine("ou turn off the light and run back to your room and lock the door.");
Console.WriteLine("THE END");
}
else
{
Console.WriteLine("You answered incorrectly. The door doesn't open.");
Console.WriteLine("THE END");
}
}
else if (doorChoice == "OPEN")
{
Console.WriteLine("The door is locked! See if one of your three keys will open it.");
Console.Write("Enter a number (1-3):");
string keyChoice = Console.ReadLine();
keyChoice = keyChoice.ToUpper();
switch (keyChoice)
{
case "1":
Console.WriteLine("You choose the first key. Lucky choice!");
Console.WriteLine("The door opens and NOTHING is there. Strange...");
Console.WriteLine("THE END");
break;
case "2":
Console.WriteLine("You choose the second key. The door doesn't open.");
Console.WriteLine("THE END");
break;
case "3":
Console.WriteLine("You choose the third key. The door doesn't open.");
Console.WriteLine("THE END");
break;
}
}
}
}
}
}