Advertisement
Guest User

Eggcelent

a guest
Jan 30th, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.90 KB | None | 0 0
  1. using System;
  2.  
  3. class Eggcelent
  4. {
  5.     static void Main()
  6.     {
  7.         int n = int.Parse(Console.ReadLine());
  8.         int width = n * 3 + 1;
  9.         int height = 2 * n;
  10.         int dotCounter = n + 1;
  11.         int counter = 0;
  12.          
  13.  
  14.         //first line --> special
  15.         Console.Write(new string('.', dotCounter));
  16.         Console.Write(new string ('*', n-1));
  17.         Console.WriteLine(new string('.', dotCounter));
  18.  
  19.         //top
  20.         int innterDotCounter = 0;
  21.         if (n == 2)
  22.         {
  23.             innterDotCounter = 3;
  24.         }
  25.         else
  26.         {
  27.             innterDotCounter = n - 3;
  28.             for (int i = n - 1; i >= 1; i -= 2)
  29.             {
  30.                 innterDotCounter += 4;
  31.                 dotCounter -= 2;
  32.                 Console.Write(new string('.', dotCounter));
  33.                 Console.Write('*');
  34.                 Console.Write(new string('.', innterDotCounter));
  35.                 Console.Write('*');
  36.                 Console.WriteLine(new string('.', dotCounter));
  37.                 counter++;
  38.             }
  39.         }
  40.    
  41.     //special part
  42.         int specialCounter = (2 * n - (4 + 2 * counter)) / 2;
  43.         if (specialCounter > 0)
  44.         {
  45.             for (int i = 0; i < specialCounter; i++)
  46.             {
  47.                 Console.Write(".*");
  48.                 Console.Write(new string('.', width - 4));
  49.                 Console.WriteLine("*.");
  50.             }
  51.         }
  52.  
  53.         //middle
  54.         Console.Write(".*");
  55.         for (int i = 1; i <= (innterDotCounter - 1) / 2; i++)
  56.         {
  57.             Console.Write("@.");
  58.         }
  59.         Console.Write('@');
  60.         Console.WriteLine("*.");
  61.  
  62.         Console.Write(".*");
  63.         for (int i = 1; i <= (innterDotCounter - 1) / 2; i++)
  64.         {
  65.             Console.Write(".@");
  66.         }
  67.         Console.Write('.');
  68.         Console.WriteLine("*.");
  69.  
  70.         //special part
  71.         if (specialCounter > 0)
  72.         {
  73.             for (int i = 0; i < specialCounter; i++)
  74.             {
  75.                 Console.Write(".*");
  76.                 Console.Write(new string('.', width - 4));
  77.                 Console.WriteLine("*.");
  78.             }
  79.         }
  80.  
  81.         //bottom
  82.         if (n == 2)
  83.         {
  84.             innterDotCounter = 3;
  85.         }
  86.         else
  87.         {
  88.             for (int i = 1; i <= n - 1; i += 2)
  89.             {
  90.                 Console.Write(new string('.', dotCounter));
  91.                 Console.Write('*');
  92.                 Console.Write(new string('.', innterDotCounter));
  93.                 Console.Write('*');
  94.                 Console.WriteLine(new string('.', dotCounter));
  95.                 dotCounter += 2;
  96.                 innterDotCounter -= 4;
  97.             }
  98.         }
  99.         //last line == first line
  100.         Console.Write(new string('.', n + 1));
  101.         Console.Write(new string('*', n - 1));
  102.         Console.WriteLine(new string('.', n + 1));
  103.  
  104.  
  105.  
  106.        
  107.     }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement