iliya87

03.DrawDNA

Mar 25th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1. using System;
  2.  
  3. class ProgrammerDNA
  4. {
  5.     static void Main()
  6.     {
  7.         int totalLength = int.Parse(Console.ReadLine());
  8.         char printChar = char.Parse(Console.ReadLine());
  9.  
  10.         char spaceChar = '.';
  11.  
  12.         int blockSize = 7;
  13.         int midPoint = blockSize / 2;
  14.         int diff = 0;
  15.         int diffCounter = 0;
  16.  
  17.         for (int counter = 0; counter < totalLength; counter++)
  18.         {
  19.             // Print Block
  20.             for (int i = 0; i < blockSize; i++)
  21.             {
  22.                 if (i >= midPoint - diff && i <= midPoint + diff)
  23.                 {
  24.                     Console.Write(printChar);
  25.  
  26.                     // Change Letter
  27.                     if (printChar == 'G')
  28.                     {
  29.                         printChar = 'A';
  30.                     }
  31.                     else
  32.                     {
  33.                         printChar++;
  34.                     }
  35.                 }
  36.                 else
  37.                 {
  38.                     Console.Write(spaceChar);
  39.                 }
  40.             }
  41.  
  42.             if (diffCounter >= midPoint)
  43.             {
  44.                 diff--;
  45.             }
  46.             else
  47.             {
  48.                 diff++;
  49.             }
  50.  
  51.             diffCounter++;
  52.  
  53.             if (diffCounter == blockSize)
  54.             {
  55.                 diffCounter = 0;
  56.                 diff++;
  57.             }
  58.  
  59.             Console.WriteLine();
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment