using System.Collections.Generic;
private string correctAnswer;
public string getNpcName()
public Riddle setNpcName(string name)
public string getRiddle()
public Riddle setRiddle(string riddle)
public string getCorrectAnswer()
return this.correctAnswer;
public Riddle setCorrectAnswer(string correctAnswer)
this.correctAnswer = correctAnswer;
public void Main(Program obj)
List<int> blockedDirections = new List<int>();
if (blockedDirections.Count == 4) {
Console.WriteLine("You are stuck and died");
List<string> choices = new List<string>(["North", "East", "South", "West"]);
foreach (int blocked in blockedDirections) {
choices.RemoveAt(blocked);
Console.WriteLine(@$"Choose an exit.
{String.Join(", ", choices.ToArray())}
int direction = Convert.ToInt32(Console.ReadLine());
Riddle riddle = this.createRiddle(direction);
if (blockedDirections.Contains(direction)) {
Console.WriteLine("Exit is sealed. ");
gameover = this.askRiddle(riddle);
blockedDirections.Add(direction);
Console.WriteLine("Game over. Thanks for playing.");
private Riddle createRiddle(int index)
.setRiddle("I have forests, but no trees. I have rivers, but no waters. I have cities but no buildings. What am I?")
.setCorrectAnswer("map");
.setNpcName("Saggitarius")
.setRiddle("The more you take from me, the bigger I become. What am I?")
.setCorrectAnswer("hole");
.setRiddle("I can't be seen but I can be heard. I will not speak, unless spoken to. What am I?")
.setCorrectAnswer("echo");
.setRiddle("I'm black when I'm bought, red when I'm used, and gray when I'm thrown away. What am I?")
.setCorrectAnswer("coal");
private bool askRiddle(Riddle riddle)
Console.WriteLine($"My name is {riddle.getNpcName()}, and this is my riddle. Should you get it wrong, this exit will forever be impassable to you.");
Console.WriteLine(riddle.getRiddle());
string playerAnswer = Console.ReadLine().ToLower();
if (playerAnswer != riddle.getCorrectAnswer()) {
Console.WriteLine("The exit is now sealed. Turn away, for your wisdom did not prove true.");
Console.WriteLine("The path is open, you may pass.");