public static void ShowGrid(string[,] grid)
for (int i = 0; i < 5; i++)
Console.WriteLine(grid[i,0] + " " + grid[i,1] + " " + grid[i,2] + " " + grid[i,3] + " " + grid[i,4]);
public static string Naming()
bool successfulName = false;
string shortenedName = " ";
while (successfulName == false)
Console.Write("Enter your name: (at least 3 characters) ");
playerName = Console.ReadLine();
if (playerName.Length < 3)
Console.WriteLine("That name is too short. Please enter a name that is at least 3 characters long.");
shortenedName = playerName.Substring(0, 1) + playerName.Substring(playerName.Length - 2);
return shortenedName.ToUpper();
public static void Main()
{"⬛", "⬛", "⬛", "⬛", "⬛",},
{"🟥", "⬛", "🟥", "👹", "🟥",},
{"⬛", "⬛", "⬛", "🟥", "⬛",},
{"⬛", "🗡️", "⬛", "⬛", "⬛",},
{"⬛", "⬛", "⬛", "🟥", "🚪",},
{"🚪", "⬛", "⬛", "⬛", "⬛",},
{"⬛", "🟥", "⬛", "🟥", "⬛",},
{"⬛", "⬛", "🔑", "⬛", "⬛",},
{"⬛", "🟥", "⬛", "🟥", "🟥",},
{"⬛", "⬛", "⬛", "⬛", "🚪",},
bool onFirstLevel = true;
string[] inventory = ["empty","empty","empty"];
string playerName = Naming();
Console.WriteLine("Welcome to the Maze, {0}.", playerName);
Console.WriteLine("Press W, A, S, or D to move, or I to view your inventory.");
while (finished == false)
if (onFirstLevel == true)
levelOne[gridx,gridy] = "🅿️";
input = (Console.ReadLine()).ToUpper();
Console.WriteLine("You hit the wall. Try again.");
else if (levelOne[gridx - 1, gridy] == "🟥")
Console.WriteLine("You hit an obstacle. Try again.");
levelOne[gridx,gridy] = "⬛";
Console.WriteLine("You hit the wall. Try again.");
else if (levelOne[gridx, gridy - 1] == "🟥")
Console.WriteLine("You hit an obstacle. Try again.");
levelOne[gridx,gridy] = "⬛";
Console.WriteLine("You hit the wall. Try again.");
else if (levelOne[gridx + 1, gridy] == "🟥")
Console.WriteLine("You hit an obstacle. Try again.");
levelOne[gridx,gridy] = "⬛";
Console.WriteLine("You hit the wall. Try again.");
else if (levelOne[gridx, gridy + 1] == "🟥")
Console.WriteLine("You hit an obstacle. Try again.");
levelOne[gridx,gridy] = "⬛";
Console.WriteLine("Your items are:");
foreach (string i in inventory)
Console.WriteLine("Please press W, A, S or D to move, or I to view inventory.");
if (levelOne[gridx,gridy] == "🗡️")
Console.WriteLine("You pick up the dagger!");
if (levelOne[gridx,gridy] == "👹" && hasDagger == true)
Console.WriteLine("You kill the monster using the dagger!");
Console.WriteLine("You loot a torch from the monster's body.");
else if (levelOne[gridx,gridy] == "👹" && hasDagger == false)
Console.WriteLine("You lose to the monster.");
if (gridx == 4 && gridy == 4)
Console.WriteLine("You move to the second floor!");
levelTwo[gridx,gridy] = "🅿️";
Console.WriteLine("It is too dark to see.");
input = (Console.ReadLine()).ToUpper();
Console.WriteLine("You hit the wall. Try again.");
else if (levelTwo[gridx - 1, gridy] == "🟥")
Console.WriteLine("You hit an obstacle. Try again.");
levelTwo[gridx,gridy] = "⬛";
Console.WriteLine("You hit the wall. Try again.");
else if (levelTwo[gridx, gridy - 1] == "🟥")
Console.WriteLine("You hit an obstacle. Try again.");
levelTwo[gridx,gridy] = "⬛";
Console.WriteLine("You hit the wall. Try again.");
else if (levelTwo[gridx + 1, gridy] == "🟥")
Console.WriteLine("You hit an obstacle. Try again.");
levelTwo[gridx,gridy] = "⬛";
Console.WriteLine("You hit the wall. Try again.");
else if (levelTwo[gridx, gridy + 1] == "🟥")
Console.WriteLine("You hit an obstacle. Try again.");
levelTwo[gridx,gridy] = "⬛";
Console.WriteLine("Your items are:");
foreach (string i in inventory)
Console.WriteLine("Please press W, A, S or D to move, or I to view inventory.");
if (gridx == 0 && gridy == 0)
Console.WriteLine("You move to the first floor!");
if (levelTwo[gridx,gridy] == "🔑")
Console.WriteLine("You pick up the key!");
if (gridx == 4 && gridy == 4 && hasKey == true)
Console.WriteLine("You win!");
Console.WriteLine("You won in {0} moves. Think you can do better?", spacesMoved);
else if (gridx == 4 && gridy == 4 && hasKey == false)
Console.WriteLine("The door is locked.");