public static void Display(string[,] Gridl1)
for(int i = 0; i < 5; i++)
for(int I = 0; I < 5; I++)
Console.Write(Gridl1[i,I]);
public static ref int UserInput(string[,] Gridl1, ref int PlayerX, ref int PlayerY, ref int game, ref int PlayerI, ref int PlayerG, ref int[] KeyPos, ref int[] SwordPos, string[] Inventory)
Console.WriteLine("\nPress W to move forwards, S to move backwards, A to move left, D to move right I to open your inventory and Q to quit");
string KeyInput = (Console.ReadLine()).ToUpper();
bool InputRunning = true;
while(InputRunning == true)
Console.WriteLine(PlayerX);
Console.WriteLine(PlayerY);
if(NPlayerX < 0 || Gridl1[NPlayerX, PlayerY] == "❌" || Gridl1[PlayerX, NPlayerY] == "🚪") {
Console.WriteLine("You cannot move there try again");
Console.WriteLine("Running WF");
Console.WriteLine("PlayerY WF" + PlayerY);
Console.WriteLine("PlayerX WF" + PlayerX);
Console.WriteLine("NPlayerX WF" + NPlayerX);
else if (Gridl1[NPlayerX, PlayerY] != "❌") {
Console.WriteLine("Running WS");
Console.WriteLine("PlayerX WS" + PlayerX);
Console.WriteLine("NPlayerX WS" + NPlayerX);
Gridl1[PlayerX, PlayerY] = "⬜";
Console.WriteLine("Error");
if(NPlayerX > 4 || Gridl1[NPlayerX, PlayerY] == "❌" || Gridl1[PlayerX, NPlayerY] == "🚪") {
Console.WriteLine("You cannot move there try again");
Console.WriteLine("Running SF");
Console.WriteLine("PlayerY SF" + PlayerY);
Console.WriteLine("PlayerX SF" + PlayerX);
Console.WriteLine("NPlayerX SF" + NPlayerX);
else if (Gridl1[NPlayerX, PlayerY] != "❌") {
Console.WriteLine("Running SS");
Console.WriteLine("PlayerX SS" + PlayerX);
Console.WriteLine("NPlayerX SS" + NPlayerX);
Gridl1[PlayerX, PlayerY] = "⬜";
Console.WriteLine("Error");
if(NPlayerY > 4 || Gridl1[PlayerX, NPlayerY] == "❌" || Gridl1[PlayerX, NPlayerY] == "🚪") {
Console.WriteLine("You cannot move there try again");
Console.WriteLine("Running DF");
Console.WriteLine("PlayerX DF" + PlayerX);
Console.WriteLine("PlayerY DF" + PlayerY);
Console.WriteLine("NPlayerY DF" + NPlayerY);
else if (Gridl1[PlayerX, NPlayerY] != "❌") {
Console.WriteLine("Running DS");
Console.WriteLine("PlayerY DS" + PlayerY);
Console.WriteLine("NPlayerY DS" + NPlayerY);
Gridl1[PlayerX, PlayerY] = "⬜";
Console.WriteLine("Error");
if(NPlayerY < 0 || Gridl1[PlayerX, NPlayerY] == "❌" || Gridl1[PlayerX, NPlayerY] == "🚪") {
Console.WriteLine("You cannot move there try again");
Console.WriteLine("Running AF");
Console.WriteLine("PlayerX AF" + PlayerX);
Console.WriteLine("PlayerY AF" + PlayerY);
Console.WriteLine("NPlayerY AF" + NPlayerY);
else if (Gridl1[PlayerX, NPlayerY] != "❌") {
Console.WriteLine("Running AS");
Console.WriteLine("PlayerY AS" + PlayerY);
Console.WriteLine("NPlayerY AS" + NPlayerY);
Gridl1[PlayerX, PlayerY] = "⬜";
Console.WriteLine("Error");
for(int i = 0; i < 3; i++)
Console.Write(Inventory[i]);
Console.WriteLine("Select an item in your inventory 1 2 or 3:");
PlayerI = (Convert.ToInt32(Console.ReadLine())) - 1;
for(int i = 0; i < 3; i++)
if(Inventory[i] == "⬜") {
if(PlayerX == KeyPos[0] && PlayerY == KeyPos[1] && PlayerG == 1) {
Inventory[FreeSpot] = "🔑";
Console.WriteLine("You have picked up a key");
else if(PlayerX == SwordPos[0] && PlayerY == SwordPos[1] && PlayerG == 2) {
Inventory[FreeSpot] = "🗡️";
Console.WriteLine("You have picked up a sword");
else if(Gridl1[PlayerX, PlayerY] == "❎") {
Console.WriteLine("There is nothing here to pickup");
else if(Inventory[0] != "⬜" && Inventory[1] != "⬜" && Inventory[2] != "⬜") {
Console.WriteLine("Inventory Full");
if(Inventory[PlayerI] == "🔑") {
Inventory[PlayerI] = "⬜";
Console.WriteLine("You have dropped the key");
return ref KeyPos[0 + 1 + 2];
else if(Inventory[PlayerI] == "🗡️") {
Inventory[PlayerI] = "⬜";
Console.WriteLine("You have dropped the sword");
return ref SwordPos[0 + 1 + 2];
Console.WriteLine("You are not holding anything");
Console.WriteLine("Invalid input please try again");
public static void Main()
string[,] Gridl0 = {{"⬜", "⬜", "⬜", "⬜", "⬜"},
{"⬜", "⬜", "👹", "⬜", "⬜"},
{"⬜", "⬜", "⬜", "⬜", "⬜"},
{"⬜", "⬜", "⬜", "⬜", "⬜"},
{"🔳", "⬜", "⬜", "⬜", "🔲"},
string[,] Gridl1 = {{"⬜", "❌", "🔑", "⬜", "⬜"},
{"⬜", "❌", "❌", "❌", "⬜"},
{"⬜", "⬜", "⬜", "⬜", "⬜"},
{"❌", "❌", "⬜", "❌", "⬜"},
{"🔳", "⬜", "⬜", "❌", "🔲"},
string[,] Gridl2 = {{"⬜", "⬜", "⬜", "❌", "🗡️"},
{"❌", "⬜", "❌", "❌", "🚪"},
{"⬜", "⬜", "⬜", "⬜", "⬜"},
{"❌", "❌", "⬜", "❌", "⬜"},
{"🔳", "⬜", "⬜", "❌", "🔲"},
string[] Inventory = {"⬜", "⬜", "⬜"};
Console.WriteLine("Welcome to THE maze");
int[] KeyPos = {0, 2, 1};
int[] SwordPos = {0, 4, 2};
Gridl1[PlayerX, PlayerY] = "❎";
Gridl2[PlayerX, PlayerY] = "❎";
UserInput(Gridl0, ref PlayerX, ref PlayerY, ref game, ref PlayerI, ref PlayerG, ref KeyPos, ref SwordPos, Inventory);
Gridl2[PlayerX, PlayerY] = "❎";
if(PlayerX == 4 && PlayerY == 4) {
Console.WriteLine("Press E to move up a level");
string UpDown = (Console.ReadLine()).ToUpper();
Gridl1[PlayerX, PlayerY] = "❎";
UserInput(Gridl1, ref PlayerX, ref PlayerY, ref game, ref PlayerI, ref PlayerG, ref KeyPos, ref SwordPos, Inventory);
Gridl1[PlayerX, PlayerY] = "❎";
if(KeyPos[0] != 9 && KeyPos[2] == 1 && KeyPos[2] != 9) {
Gridl1[KeyPos[0], KeyPos[1]] = "🔑";
if(SwordPos[0] != 9 && SwordPos[2] == 1 && SwordPos[2] != 9) {
Gridl1[SwordPos[0], SwordPos[1]] = "🗡️";
if(PlayerX == 4 && PlayerY == 0) {
Console.WriteLine("Press E to move down a level");
string UpDown = (Console.ReadLine()).ToUpper();
else if(PlayerX == 4 && PlayerY == 4) {
Console.WriteLine("Press E to move up a level");
string UpDown = (Console.ReadLine()).ToUpper();
Gridl2[PlayerX, PlayerY] = "❎";
UserInput(Gridl2, ref PlayerX, ref PlayerY, ref game, ref PlayerI, ref PlayerG, ref KeyPos, ref SwordPos, Inventory);
Gridl2[PlayerX, PlayerY] = "❎";
if(SwordPos[0] != 9 && KeyPos[2] != 9) {
Gridl2[SwordPos[0], SwordPos[1]] = "🗡️";
if(KeyPos[0] != 9 && SwordPos[2] != 9) {
Gridl1[KeyPos[0], KeyPos[1]] = "🔑";
if(PlayerX == 4 && PlayerY == 0) {
Console.WriteLine("Press E to move down a level");
string UpDown = (Console.ReadLine()).ToUpper();
else if(PlayerX == 1 && PlayerY == 4 && DoorState == true) {
Console.WriteLine("Press E to unlock the door");
string UserInput = (Console.ReadLine()).ToUpper();
if(Inventory[PlayerI] == "🔑" && UserInput == "E") {
Console.WriteLine("You have opened the door");
else if(Inventory[PlayerI] != "🔑") {
Console.WriteLine("You cannot open the door because you are not holding the key");
Console.WriteLine(PlayerX);
Console.WriteLine(PlayerY);