Advertisement
ivan_yosifov

Eggcelent

Dec 8th, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.13 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 height = 2 * N;
  9.         int width = (3 * N) - 1;
  10.         int topHeight = N - 1;
  11.         int bottomHeight = N - 1;
  12.         int outerDots = N;
  13.         int innerSymbols = N - 1;
  14.         int count = 0;
  15.  
  16.         // print top row
  17.         Console.Write('.');
  18.         Console.Write(new string('.', outerDots));
  19.         Console.Write(new string('*', innerSymbols));
  20.         Console.Write(new string('.', outerDots));
  21.         Console.Write('.');
  22.         Console.WriteLine();
  23.  
  24.         // print top part
  25.         for (int i = 1; i < topHeight; i++)
  26.         {
  27.             outerDots -= 2;
  28.             if (i == 1) innerSymbols += 2;
  29.             else innerSymbols += 4;
  30.             if (outerDots <= 0)
  31.             {
  32.                 outerDots = 0;
  33.                 innerSymbols = width - 2;
  34.                 count++;
  35.             }
  36.  
  37.             Console.Write('.');
  38.            
  39.             Console.Write(new string('.', outerDots));
  40.             Console.Write('*');
  41.             Console.Write(new string('.', innerSymbols));
  42.             Console.Write('*');
  43.             Console.Write(new string('.', outerDots));
  44.  
  45.             Console.Write('.');
  46.             Console.WriteLine();
  47.         }
  48.  
  49.         // print ribbon
  50.         for (int i = 0; i < 2; i++)
  51.         {
  52.             Console.Write(".*");
  53.             for (int j = 0; j < width - 2; j++)
  54.             {
  55.                 if (i == 0)
  56.                 {
  57.                     if (j % 2 == 1) Console.Write('.');
  58.                     else Console.Write('@');
  59.                 }
  60.                 else
  61.                 {
  62.                     if (j % 2 == 1) Console.Write('@');
  63.                     else Console.Write('.');
  64.                 }
  65.             }
  66.             Console.Write("*.");
  67.             Console.WriteLine();
  68.         }
  69.  
  70.         // print bottom part
  71.         outerDots = 0;
  72.         innerSymbols = width - 4;
  73.  
  74.         for (int i = bottomHeight - 1; i >= 1; i--)
  75.         {
  76.             if (count > 0)
  77.             {
  78.                 outerDots = 0;
  79.                 innerSymbols = width - 2;
  80.             }
  81.             else
  82.             {
  83.                 outerDots += 2;
  84.                 innerSymbols -= 4;
  85.             }
  86.             if (outerDots >=  width)
  87.             {
  88.                 outerDots = 0;
  89.                 innerSymbols = width + 2;
  90.             }
  91.  
  92.             Console.Write('.');
  93.  
  94.             Console.Write(new string('.', outerDots));
  95.             Console.Write('*');
  96.             Console.Write(new string('.', innerSymbols));
  97.             Console.Write('*');
  98.             Console.Write(new string('.', outerDots));
  99.  
  100.             Console.Write('.');
  101.             Console.WriteLine();
  102.             count--;
  103.         }
  104.  
  105.         // print bottom row
  106.         outerDots = N;
  107.         innerSymbols = N - 1;
  108.         Console.Write('.');
  109.         Console.Write(new string('.', outerDots));
  110.         Console.Write(new string('*', innerSymbols));
  111.         Console.Write(new string('.', outerDots));
  112.         Console.Write('.');
  113.         Console.WriteLine();
  114.     }
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement