Skip to content

Instantly share code, notes, and snippets.

Created August 2, 2014 18:38
Show Gist options
  • Save anonymous/5b6965d67ca85ee37f90 to your computer and use it in GitHub Desktop.
Save anonymous/5b6965d67ca85ee37f90 to your computer and use it in GitHub Desktop.
using System;
class HouseWithWindow
{
static void Main()
{
int n = int.Parse(Console.ReadLine());
int dots = n - 1;
int innerDots = 1;
Console.WriteLine("{0}*{0}",new string('.',dots));
for (int i = 0; i < n-2; i++)
{
dots--;
Console.WriteLine("{0}*{1}*{0}",new string('.',dots), new string('.',innerDots));
innerDots += 2;
}
Console.WriteLine("*{0}*",new string('.',2*n-3));
Console.WriteLine("{0}",new string('*',2*n-1));
int cycleSpins = (n - n / 2) / 2;
for (int i = 0; i < cycleSpins; i++)
{
Console.WriteLine("*{0}*", new string('.', 2 * n - 3)); //copy later
}
int windowDots = ((2*n-3)-(n-3))/2;
for (int i = 0; i < n/2; i++)
{
Console.WriteLine("*{0}{1}{0}*", new string('.',windowDots), new string ('*',n-3));
}
for (int i = 0; i < cycleSpins; i++)
{
Console.WriteLine("*{0}*", new string('.', 2 * n - 3));
}
Console.WriteLine("{0}", new string('*', 2 * n - 1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment