I am writing a program for connect 4 that works very well. Only problem is that in visual studio the method
public static void Display(char[,] board)
{
Console.Clear();
for (int i = 1; i < 8; i++)
{
Console.Write(" " + i);
}
Console.WriteLine();
for (int j = 0; j < 15; j++)
{
Console.Write("_");
}
Console.WriteLine();
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < 7; j++)
{
Console.Write("|" + board[i, j]);
}
Console.WriteLine('|');
}
for (int j = 0; j < 15; j++)
{
Console.Write("¯");
}
Console.WriteLine();
}
prints the last for loop too low. It is inadequate. It should be like that (works in repl)
but gets printed like that (in VS)
I tried to use ¯ instead of ‾ but it just printed out question marks ??????????
Why not using the good old Box Drawing characters?
You will have an output like this:
public static void Display(char[,] board)
{
Console.Clear();
Console.Write(" ");
for (int i = 1; i < 8; i++)
{
Console.Write(" " + i + " ");
}
Console.WriteLine();
Console.Write("┌");
for (int j = 0; j < 6; j++)
{
Console.Write("───┬");
}
Console.WriteLine("───┐");
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < 7; j++)
{
Console.Write("│" + " " + board[i, j] + " ");
}
Console.WriteLine("│");
Console.Write(i < 5 ? "├───┼" : "└───┴");
for (int j = 0; j < 5; j++)
{
Console.Write(i < 5 ? "───┼" : "───┴");
}
Console.WriteLine(i < 5 ? "───┤" : "───┘");
}
Console.WriteLine();
}