Original Post
Not sure if this warrents a thread on its own but yep I've finished the project, trying to draw the maze out proved to be more difficult than I thought and I feel like I was just hacking code out in a desperate attempt to get something working. I was literally writing code, running the program, getting an index out of bounds exception then back to writing code and repeating the whole cycle again. It was such a relief when I finally ran the code and it produced a maze that looked right. Anyway I was going to post my full code on the other thread but I feel I need to refactor the code a bit before posting and at the moment I don't really feel like touching the code in case I break something. This is how my code for drawing the maze ended up: How do you post pictures on threads?
//draw the maze
int r = 0;//room we're in
int row = 0;
string top = new string('_', columns + (columns - 1));
top = " " + top;
Console.WriteLine(top);
while (r < numRooms - 1)
{
Console.Write("|");
for (int i = 0; i < columns; i++)
{
if (i == columns - 1 && r < numRooms -1)
{
int sWall = r + (columns - 1) * (row + 1);
if (wallArray[sWall].isWallUp)
Console.Write("_");
else
Console.Write(" ");
Console.Write("|");
r++;
row++;
}
else if (r == numRooms - 1)
{
Console.Write("_|");
}
else if (row == rows - 1 && r < numRooms - 1)
{
Console.Write("_");
int eWall = r + (columns - 1) * row;
if (wallArray[eWall].isWallUp)
Console.Write("|");
else
Console.Write("_");
r++;
}
else
{
int sWall = r + (columns - 1) * (row + 1);
int eWall = r + (columns - 1) * row;
if (wallArray[sWall].isWallUp)
Console.Write("_");
else
Console.Write(" ");
if (wallArray[eWall].isWallUp)
Console.Write("|");
else
Console.Write(" ");
r++;
}
}
Console.WriteLine();
}
