Advertisement
DennyGD

Untitled

Jan 31st, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.06 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Eggcelent
  4. {
  5.     class Eggcelent
  6.     {
  7.         static void Main()
  8.         {
  9.             int N = Int32.Parse(Console.ReadLine());
  10.             int stars = N - 1;
  11.             int drawingArea = (3 * N) + 1;
  12.             int vertical = (N / 2) - 2;
  13.             int height = N - (2 + vertical);
  14.             int dotsEnd = (drawingArea - stars) / 2;
  15.             int dotsMiddle = N + 1;
  16.  
  17.             //first line of egg
  18.             Console.Write(new string('.', dotsEnd));
  19.             Console.Write(new string('*', stars));
  20.             Console.Write(new string('.', dotsEnd));
  21.             Console.WriteLine();
  22.            
  23.             //the lines below the first line
  24.             dotsEnd -= 2;
  25.  
  26.             for (int i = 0; i < height; i++)
  27.             {
  28.                 Console.Write(new string('.', dotsEnd));
  29.                 Console.Write('*');
  30.                 Console.Write(new string('.', dotsMiddle));
  31.                 Console.Write('*');
  32.                 Console.Write(new string('.', dotsEnd));
  33.                 Console.WriteLine();
  34.  
  35.                 dotsEnd -= 2;
  36.                 dotsMiddle += 4;
  37.             }
  38.  
  39.             //loop for the line(s) just above the monkey symbols with 1 dotsEnd
  40.             dotsMiddle = drawingArea - 4;
  41.  
  42.             for (int i = 0; i < vertical; i++)
  43.             {
  44.                 Console.Write('.');
  45.                 Console.Write('*');
  46.                 Console.Write(new string('.', dotsMiddle));
  47.                 Console.Write('*');
  48.                 Console.Write('.');
  49.                 Console.WriteLine();
  50.             }
  51.  
  52.             //the two lines with monkey symbols
  53.             int monkeyCounter = 2;
  54.             Console.Write('.');
  55.             Console.Write('*');
  56.             //first line of monkey symbols
  57.             for (int i = 0; i < (drawingArea - 4); i++)
  58.             {
  59.                 if (monkeyCounter % 2 == 0)
  60.                 {
  61.                     Console.Write('@');
  62.                 }
  63.                 else
  64.                 {
  65.                     Console.Write('.');
  66.                 }
  67.                 monkeyCounter++;
  68.             }
  69.  
  70.             Console.Write('*');
  71.             Console.Write('.');
  72.             Console.WriteLine();
  73.             //second line of monkey symbols
  74.             monkeyCounter = 2;
  75.             Console.Write('.');
  76.             Console.Write('*');
  77.  
  78.             for (int i = 0; i < (drawingArea - 4); i++)
  79.             {
  80.                 if (monkeyCounter % 2 == 0)
  81.                 {
  82.                     Console.Write('.');
  83.                 }
  84.                 else
  85.                 {
  86.                     Console.Write('@');
  87.                 }
  88.                 monkeyCounter++;
  89.             }
  90.  
  91.             Console.Write('*');
  92.             Console.Write('.');
  93.             Console.WriteLine();
  94.  
  95.             //loop for the line(s) just below the monkey symbols with 1 dotsEnd
  96.             dotsMiddle = drawingArea - 4;
  97.  
  98.             for (int i = 0; i < vertical; i++)
  99.             {
  100.                 Console.Write('.');
  101.                 Console.Write('*');
  102.                 Console.Write(new string('.', dotsMiddle));
  103.                 Console.Write('*');
  104.                 Console.Write('.');
  105.                 Console.WriteLine();
  106.             }
  107.  
  108.             //main part of the bottom of the egg
  109.             dotsEnd = 1;
  110.             dotsMiddle = drawingArea - 4;
  111.             for (int i = 0; i < height; i++)
  112.             {
  113.                 Console.Write(new string('.', dotsEnd));
  114.                 Console.Write('*');
  115.                 Console.Write(new string('.', dotsMiddle));
  116.                 Console.Write('*');
  117.                 Console.Write(new string('.', dotsEnd));
  118.                 Console.WriteLine();
  119.  
  120.                 dotsEnd += 2;
  121.                 dotsMiddle -= 4;
  122.             }
  123.  
  124.             //the last line
  125.             dotsEnd = (drawingArea - stars) / 2;
  126.             Console.Write(new string('.', dotsEnd));
  127.             Console.Write(new string('*', stars));
  128.             Console.Write(new string('.', dotsEnd));
  129.             Console.WriteLine();
  130.         }
  131.     }
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement