public static bool incomplete = true;
public static void Main()
Storage s = new Storage();
Program p = new Program();
bool simplifyWalls = false;
Console.WriteLine("If the grid is misaligned, please restart the program, type A, and press enter. If it does not, please press enter.");
string a = Console.ReadLine();
if (a == "A" || a == "a") {
Console.WriteLine("You are the white box with the black center. type w, a, s or d and press enter to move up, left, down, or right respectively.\nYou " +
"cannot move through walls, and you need to get to the black diamond to go to the next level.");
p.doLevel(s.level1, 0, simplifyWalls);
Console.WriteLine("You must collect all crossed circles to proceed through the end of the level.");
p.doLevel(s.level2, 1, simplifyWalls);
Console.WriteLine("The number shown is a gate. You must collect that many crossed circles for it to open. You cannot pass through if it is closed.");
p.doLevel(s.level3, 3, simplifyWalls);
public void doLevel(string[,] level, int need, bool simplified) {
Program p = new Program();
Storage s = new Storage();
Player player = new Player(s.findPlayer(level));
player.currentLevel = level;
Program.incomplete = true;
for (int i = 0; i < level.GetLength(0); i++) {
for (int j = 0; j < level.GetLength(1); j++) {
if ("┃━┗┓┛┏┣┫┳┻╋╻╸╹╺".Contains(level[i, j])) {
while (Program.incomplete) {
string input = Console.ReadLine();
player.Move(s.getBordering(level, player.Pos), input, s.needToCollect, level);
Console.WriteLine("\n\n\n");
public string[,] level1 = {
{"▢", "▢", "▢", "┃", "◆"},
{"▢", "▢", "▢", "┃", "▢"},
{"▢", "╻", "▢", "╹", "▢"},
{"▢", "┃", "▢", "▢", "▢"},
{"▣", "┃", "▢", "▢", "▢"}
public string[,] level2 = {
{"◆", "▢", "▢", "▢", "▢", "▢", "▢"},
{"━", "━", "━", "━", "━", "┓", "▢"},
{"▢", "▢", "▢", "▢", "▢", "┃", "▢"},
{"▢", "┏", "━", "╸", "▢", "╹", "▢"},
{"▢", "┃", "🕀", "▢", "▢", "▢", "▢"},
{"▢", "┗", "━", "━", "━", "━", "━"},
{"▢", "▢", "▢", "▢", "▢", "▢", "▣"},
public string[,] level3 = {
{"◆", "┃", "🕀", "▢", "▢"},
{"▢", "┣", "━", "┓", "▢"},
{"2", "┃", "🕀", "┃", "▢"},
{"▢", "╹", "▢", "▢", "▢"},
{"▢", "▢", "▢", "┏", "━"},
{"▢", "▣", "▢", "╹", "🕀"},
{"▢", "▢", "▢", "▢", "▢"}
public int needToCollect;
public string charType (string character) {
string walls = "┃━┗┓┛┏┣┫┳┻╋╻╸╹╺◼";
if (walls.Contains(character)) {
public void draw (string[,] grid) {
for (int i = 0; i < grid.GetLength(0); i++) {
for (int j = 0; j < grid.GetLength(1); j++) {
Console.Write(grid[i, j]);
public int[] findPlayer(string[,] level) { for (int i = 0; i < level.GetLength(0); i++) { for (int j = 0; j < level.GetLength(1); j++) { if (level[i, j] == "▣") { return new int[] {i, j}; } } }
throw new NullReferenceException("Character missing");
public string[] getBordering(string[,] level, int[] coords) {
string[] returner = {"", "", "", ""};
returner[0] = charType(level[coords[0] - 1, coords[1]]);
if (coords[0] != level.GetLength(0) - 1) {
returner[1] = charType(level[coords[0] + 1, coords[1]]);
returner[2] = charType(level[coords[0], coords[1] - 1]);
if (coords[1] != level.GetLength(1) - 1) {
returner[3] = charType(level[coords[0], coords[1] + 1]);
public void updateGates (string[,] level) {
for (int i = 0; i < level.GetLength(0); i++) {
for (int j = 0; j < level.GetLength(1); j++) {
for (int k = 0; k < 9; k++) {
if (level[i, j] == "123456789"[k].ToString()) {
level[i, j] = "▢12345678"[k].ToString();
public class Player : LevelObject {
public Player (int[] sp) : base(sp) {
public void Move (string[] bordering, string input, int need, string[,] level) {
moveMethod('u', bordering[0], level, need);
moveMethod('d', bordering[1], level, need);
moveMethod('l', bordering[2], level, need);
moveMethod('r', bordering[3], level, need);
default: Console.WriteLine("ERROR: INVALID INPUT"); break;
public void moveMethod (char direction, string border, string[,] level, int need) {
if (border == "background") {
currentLevel[Pos[0], Pos[1]] = "▢";
currentLevel[Pos[0], Pos[1]] = "▣";
if (border == "exit") { Program.incomplete = false; }
if (border == "collectable") {
currentLevel[Pos[0], Pos[1]] = "▢";
currentLevel[Pos[0], Pos[1]] = "▣";
public class LevelObject { public LevelObject (int[] sp) { StartPos = sp; Pos = sp; }
protected Storage s = new Storage();
private int[] startPos; public int[] StartPos { get{ return startPos; } set{ startPos = value; } }
private int[] pos; public int[] Pos { get { return pos; } set { pos = value; } }
public string[,] currentLevel;