Skip to content

Instantly share code, notes, and snippets.

@rdeioris
Last active October 26, 2017 16:41
Show Gist options
  • Save rdeioris/6129154f5486f52ef64d3c4e61585b7e to your computer and use it in GitHub Desktop.
Save rdeioris/6129154f5486f52ef64d3c4e61585b7e to your computer and use it in GitHub Desktop.
static void Main(string[] args)
{
int width = 80;
int height = 20;
// iterate each y
for (int y = 0; y < height; y++)
{
// iterate each x
for (int x = 0; x < width; x++)
{
// draw a sharp if we are at the edges of the terminal
if (x == 0 || x == width - 1 || y == 0 || y == height - 1)
{
Console.BackgroundColor = ConsoleColor.DarkGreen;
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("#");
}
// othwerwise draw a space to advance the cursor
else
{
Console.BackgroundColor = ConsoleColor.Black;
Console.ForegroundColor = ConsoleColor.Black;
Console.Write(" ");
}
}
// end of a line, go below
Console.WriteLine();
}
Console.ReadLine();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment