Last active
October 26, 2017 16:41
-
-
Save rdeioris/6129154f5486f52ef64d3c4e61585b7e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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